frame(XVal,YVal) and (
 function absolute ( float a,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     if(a<0) then 
     {
         return<==1 and RValue:=-a;
         skip
     }
     else
     {
         return<==1 and RValue:=a;
         skip
     }
     )
     }; 
  function min ( float a,float b,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     if(a>b) then 
     {
         return<==1 and RValue:=b;
         skip
     }
     else
     {
         return<==1 and RValue:=a;
         skip
     }
     )
     }; 
  function equal ( float a,float b,int RValue )
 {
     frame(equal_1_temp$_1,return) and ( 
     int return<==0 and skip;
     float equal_1_temp$_1 and skip;
     equal_1_temp$_1:=absolute(a-b,RValue);
     if(equal_1_temp$_1<0.00000001) then 
     {
         return<==1 and RValue:=1;
         skip
     }
     else
     {
         return<==1 and RValue:=0;
         skip
     }
     )
     }; 
  function F2S ( float f,char *str,char* RValue )
 {
     frame(F2S_str1,F2S_j,F2S_k,F2S_i,F2S_d,return) and ( 
     int return<==0 and skip;
     char F2S_str1[40] and skip;
     int F2S_j<==0,F2S_k,F2S_i and skip;
     float F2S_d and skip;
     F2S_d:=absolute(f,RValue);
     F2S_i:=(int)F2S_d;
     while( (F2S_i>0) )
     {
         F2S_str1[F2S_j]:=F2S_i % 10+'0';
         F2S_j:=F2S_j+1;
         F2S_i:=F2S_i/ 10
     };
     F2S_k:=0;
     
     while( (F2S_k<F2S_j) )
     {
         str[F2S_k]:=F2S_str1[F2S_j-1-F2S_k];
         F2S_k:=F2S_k+1
         
     };
     if((int)F2S_d=0) then 
     {
         str[F2S_j]:='0';
         F2S_j:=F2S_j+1
         
     }
     else 
     {
          skip 
     };
     str[F2S_j]:='.';
     F2S_j:=F2S_j+1;
     F2S_d:=F2S_d-(int)F2S_d;
     F2S_i:=0;
     
     while( (F2S_i<4) )
     {
         F2S_d:=F2S_d*10;
         str[F2S_j]:=(int)F2S_d+'0';
         F2S_j:=F2S_j+1;
         F2S_d:=F2S_d-(int)F2S_d;
         F2S_i:=F2S_i+1
         
     };
     str[F2S_j]:='\0';
     if(f<0) then 
     {
         F2S_j:=0;
         while( (str[F2S_j]!='\0') )
         {
             F2S_j:=F2S_j+1
         };
         str[F2S_j+1]:='\0';
         while( (F2S_j>0) )
         {
             str[F2S_j]:=str[F2S_j-1];
             F2S_j:=F2S_j-1
         };
         str[0]:='-'
         
     }
     else 
     {
          skip 
     };
     return<==1 and RValue:=str;
     skip
     )
     }; 
      struct Mat {
     int row,col and 
     float **element 
 };
 function MatCreate ( Mat *mat,int row,int col,Mat* RValue )
 {
     frame(MatCreate_i,MatCreate_2_j,return) and ( 
     int return<==0 and skip;
     int MatCreate_i and skip;
     mat->element:=(float **)malloc(row*sizeof(float *));
     if(mat->element=NULL) then 
     {
         output ("mat create fail! size:[",row,",",col,"]\n") and skip;
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         MatCreate_i:=0;
         
         while( return=0 AND   (MatCreate_i<row) )
         {
             mat->element[MatCreate_i]:=(float *)malloc(col*sizeof(float));
             if(mat->element[MatCreate_i]=NULL) then 
             {
                 int MatCreate_2_j and skip;
                 output ("mat create fail! size:[",row,",",col,"],spot:[",MatCreate_i,"]\n") and skip;
                 MatCreate_2_j:=0;
                 
                 while( (MatCreate_2_j<MatCreate_i) )
                 {
                     free(mat->element[MatCreate_2_j]) and skip;
                     MatCreate_2_j:=MatCreate_2_j+1
                     
                 };
                 free(mat->element) and skip;
                 return<==1 and RValue:=NULL;
                 skip
                 
             }
             else 
             {
                  skip 
             };
             if(return=0)   then 
             {
                 MatCreate_i:=MatCreate_i+1
             }
             else
             {
                 skip
             }
             
         };
         if(return=0)   then 
         {
             mat->row:=row;
             mat->col:=col;
             return<==1 and RValue:=mat;
             skip
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function MatDelete ( Mat *mat )
 {
     frame(MatDelete_i) and ( 
     int MatDelete_i and skip;
     MatDelete_i:=0;
     
     while( (MatDelete_i<mat->row) )
     {
         free(mat->element[MatDelete_i]) and skip;
         MatDelete_i:=MatDelete_i+1
         
     };
     free(mat->element) and skip
     )
     }; 
  function MatSetVal ( Mat *mat,float *val,Mat* RValue )
 {
     frame(MatSetVal_row,MatSetVal_col,return) and ( 
     int return<==0 and skip;
     int MatSetVal_row,MatSetVal_col and skip;
     MatSetVal_row:=0;
     
     while( (MatSetVal_row<mat->row) )
     {
         MatSetVal_col:=0;
         
         while( (MatSetVal_col<mat->col) )
         {
             (mat->element[MatSetVal_row])[MatSetVal_col]:=val[MatSetVal_col+MatSetVal_row*mat->col];
             MatSetVal_col:=MatSetVal_col+1
             
         };
         MatSetVal_row:=MatSetVal_row+1
         
     };
     return<==1 and RValue:=mat;
     skip
     )
     }; 
  function MatShape ( Mat *mat )
 {
     output ("Mat ",mat->row,"x",mat->col,":\n") and skip
     
 };
 function MatDump ( Mat *mat )
 {
     frame(MatDump_row,MatDump_col,MatDump_str,MatDump_data) and ( 
     int MatDump_row,MatDump_col and skip;
     char MatDump_str[40] and skip;
     char *MatDump_data and skip;
     output ("Mat ",mat->row,"x",mat->col,":\n") and skip;
     MatDump_row:=0;
     
     while( (MatDump_row<mat->row) )
     {
         MatDump_col:=0;
         
         while( (MatDump_col<mat->col) )
         {
             MatDump_data:=F2S((mat->element[MatDump_row])[MatDump_col],MatDump_str,RValue);
             if(MatDump_data[0]='-') then 
             {
                 output (" ",F2S((mat->element[MatDump_row])[MatDump_col],MatDump_str,RValue),"\t") and skip
                 
             }
             else
             {
                 output ("  ",F2S((mat->element[MatDump_row])[MatDump_col],MatDump_str,RValue),"\t") and skip
             };
             MatDump_col:=MatDump_col+1
             
         };
         output ("\n") and skip;
         MatDump_row:=MatDump_row+1
         
     };
     output ("\n") and skip
     )
     }; 
  function MatZeros ( Mat *mat,Mat* RValue )
 {
     frame(MatZeros_row,MatZeros_col,return) and ( 
     int return<==0 and skip;
     int MatZeros_row,MatZeros_col and skip;
     MatZeros_row:=0;
     
     while( (MatZeros_row<mat->row) )
     {
         MatZeros_col:=0;
         
         while( (MatZeros_col<mat->col) )
         {
             (mat->element[MatZeros_row])[MatZeros_col]:=0.0;
             MatZeros_col:=MatZeros_col+1
             
         };
         MatZeros_row:=MatZeros_row+1
         
     };
     return<==1 and RValue:=mat;
     skip
     )
     }; 
  function MatOnes ( Mat *mat,Mat* RValue )
 {
     frame(MatOnes_row,MatOnes_col,return) and ( 
     int return<==0 and skip;
     int MatOnes_row,MatOnes_col and skip;
     MatOnes_row:=0;
     
     while( (MatOnes_row<mat->row) )
     {
         MatOnes_col:=0;
         
         while( (MatOnes_col<mat->col) )
         {
             (mat->element[MatOnes_row])[MatOnes_col]:=1.0;
             MatOnes_col:=MatOnes_col+1
             
         };
         MatOnes_row:=MatOnes_row+1
         
     };
     return<==1 and RValue:=mat;
     skip
     )
     }; 
  function MatEye ( Mat *mat,Mat* RValue )
 {
     frame(MatEye_i,return) and ( 
     int return<==0 and skip;
     int MatEye_i and skip;
     MatZeros(mat,RValue);
     MatEye_i:=0;
     
     while( (MatEye_i<min((float)(mat->row),(float)(mat->col),RValue)) )
     {
         (mat->element[MatEye_i])[MatEye_i]:=1.0;
         MatEye_i:=MatEye_i+1
         
     };
     return<==1 and RValue:=mat;
     skip
     )
     }; 
  function MatAdd ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatAdd_row,MatAdd_col,return) and ( 
     int return<==0 and skip;
     int MatAdd_row,MatAdd_col and skip;
     MatAdd_row:=0;
     
     while( (MatAdd_row<src1->row) )
     {
         MatAdd_col:=0;
         
         while( (MatAdd_col<src1->col) )
         {
             (dst->element[MatAdd_row])[MatAdd_col]:=(src1->element[MatAdd_row])[MatAdd_col]+(src2->element[MatAdd_row])[MatAdd_col];
             MatAdd_col:=MatAdd_col+1
             
         };
         MatAdd_row:=MatAdd_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatSub ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatSub_row,MatSub_col,return) and ( 
     int return<==0 and skip;
     int MatSub_row,MatSub_col and skip;
     MatSub_row:=0;
     
     while( (MatSub_row<src1->row) )
     {
         MatSub_col:=0;
         
         while( (MatSub_col<src1->col) )
         {
             (dst->element[MatSub_row])[MatSub_col]:=(src1->element[MatSub_row])[MatSub_col]-(src2->element[MatSub_row])[MatSub_col];
             MatSub_col:=MatSub_col+1
             
         };
         MatSub_row:=MatSub_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatMul ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatMul_row,MatMul_col,MatMul_i,MatMul_temp1,MatMul_temp2,MatMul_1_temp$_1,MatMul_1_2_temp$_2,return) and ( 
     int return<==0 and skip;
     int MatMul_row,MatMul_col and skip;
     int MatMul_i and skip;
     MatZeros(dst,RValue);
     float MatMul_temp1<==0.0 and skip;
     float MatMul_temp2<==0.0 and skip;
     MatMul_row:=0;
     
     while( (MatMul_row<src1->row) )
     {
         MatMul_col:=0;
         
         while( (MatMul_col<src1->col) )
         {
             MatMul_temp1:=(src1->element[MatMul_row])[MatMul_col];
             int MatMul_1_temp$_1 and skip;
             MatMul_1_temp$_1:=equal(MatMul_temp1,0,RValue);
             if(MatMul_1_temp$_1=0) then 
             {
                 MatMul_i:=0;
                 
                 while( (MatMul_i<src2->col) )
                 {
                     MatMul_temp2:=(src2->element[MatMul_col])[MatMul_i];
                     int MatMul_1_2_temp$_2 and skip;
                     MatMul_1_2_temp$_2:=equal(MatMul_temp2,0,RValue);
                     if(MatMul_1_2_temp$_2=0) then 
                     {
                         (dst->element[MatMul_row])[MatMul_i]:=(dst->element[MatMul_row])[MatMul_i]+MatMul_temp1*MatMul_temp2
                         
                     }
                     else 
                     {
                          skip 
                     };
                     MatMul_i:=MatMul_i+1
                     
                 }
                 
             }
             else 
             {
                  skip 
             };
             MatMul_col:=MatMul_col+1
             
         };
         MatMul_row:=MatMul_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatMul2 ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatMul2_row,MatMul2_col,MatMul2_i,MatMul2_temp,return) and ( 
     int return<==0 and skip;
     int MatMul2_row,MatMul2_col and skip;
     int MatMul2_i and skip;
     float MatMul2_temp and skip;
     MatMul2_row:=0;
     
     while( (MatMul2_row<dst->row) )
     {
         MatMul2_col:=0;
         
         while( (MatMul2_col<dst->col) )
         {
             MatMul2_i:=0;
             
             while( (MatMul2_i<src1->col) )
             {
                 (dst->element[MatMul2_row])[MatMul2_col]:=(dst->element[MatMul2_row])[MatMul2_col]+(src1->element[MatMul2_row])[MatMul2_i]*(src2->element[MatMul2_i])[MatMul2_col];
                 MatMul2_i:=MatMul2_i+1
                 
             };
             MatMul2_col:=MatMul2_col+1
             
         };
         MatMul2_row:=MatMul2_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatProduct ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatProduct_row,MatProduct_col,return) and ( 
     int return<==0 and skip;
     int MatProduct_row,MatProduct_col and skip;
     MatProduct_row:=0;
     
     while( (MatProduct_row<src1->row) )
     {
         MatProduct_col:=0;
         
         while( (MatProduct_col<src1->col) )
         {
             (dst->element[MatProduct_row])[MatProduct_col]:=(src1->element[MatProduct_row])[MatProduct_col]*(src2->element[MatProduct_row])[MatProduct_col];
             MatProduct_col:=MatProduct_col+1
             
         };
         MatProduct_row:=MatProduct_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDiv ( Mat *src1,Mat *src2,Mat *dst,Mat* RValue )
 {
     frame(MatDiv_row,MatDiv_col,return) and ( 
     int return<==0 and skip;
     int MatDiv_row,MatDiv_col and skip;
     MatDiv_row:=0;
     
     while( (MatDiv_row<src1->row) )
     {
         MatDiv_col:=0;
         
         while( (MatDiv_col<src1->col) )
         {
             (dst->element[MatDiv_row])[MatDiv_col]:=(src1->element[MatDiv_row])[MatDiv_col]/ (src2->element[MatDiv_row])[MatDiv_col];
             MatDiv_col:=MatDiv_col+1
             
         };
         MatDiv_row:=MatDiv_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatNumMul ( float num,Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatNumMul_row,MatNumMul_col,return) and ( 
     int return<==0 and skip;
     int MatNumMul_row,MatNumMul_col and skip;
     MatNumMul_row:=0;
     
     while( (MatNumMul_row<src->row) )
     {
         MatNumMul_col:=0;
         
         while( (MatNumMul_col<src->col) )
         {
             (dst->element[MatNumMul_row])[MatNumMul_col]:=num*(src->element[MatNumMul_row])[MatNumMul_col];
             MatNumMul_col:=MatNumMul_col+1
             
         };
         MatNumMul_row:=MatNumMul_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatNumAdd ( float num,Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatNumAdd_row,MatNumAdd_col,return) and ( 
     int return<==0 and skip;
     int MatNumAdd_row,MatNumAdd_col and skip;
     MatNumAdd_row:=0;
     
     while( (MatNumAdd_row<src->row) )
     {
         MatNumAdd_col:=0;
         
         while( (MatNumAdd_col<src->col) )
         {
             (dst->element[MatNumAdd_row])[MatNumAdd_col]:=num+(src->element[MatNumAdd_row])[MatNumAdd_col];
             MatNumAdd_col:=MatNumAdd_col+1
             
         };
         MatNumAdd_row:=MatNumAdd_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatTrans ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatTrans_row,MatTrans_col,return) and ( 
     int return<==0 and skip;
     int MatTrans_row,MatTrans_col and skip;
     MatTrans_row:=0;
     
     while( (MatTrans_row<dst->row) )
     {
         MatTrans_col:=0;
         
         while( (MatTrans_col<dst->col) )
         {
             (dst->element[MatTrans_row])[MatTrans_col]:=(src->element[MatTrans_col])[MatTrans_row];
             MatTrans_col:=MatTrans_col+1
             
         };
         MatTrans_row:=MatTrans_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatRowSum ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatRowSum_row,MatRowSum_col,MatRowSum_temp,return) and ( 
     int return<==0 and skip;
     int MatRowSum_row,MatRowSum_col and skip;
     float MatRowSum_temp and skip;
     MatRowSum_row:=0;
     
     while( (MatRowSum_row<src->row) )
     {
         MatRowSum_temp:=0;
         MatRowSum_col:=0;
         
         while( (MatRowSum_col<src->col) )
         {
             MatRowSum_temp:=MatRowSum_temp+(src->element[MatRowSum_row])[MatRowSum_col];
             MatRowSum_col:=MatRowSum_col+1
             
         };
         (dst->element[MatRowSum_row])[0]:=MatRowSum_temp;
         MatRowSum_row:=MatRowSum_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatRowMax ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatRowMax_row,MatRowMax_col,MatRowMax_temp,return) and ( 
     int return<==0 and skip;
     int MatRowMax_row,MatRowMax_col and skip;
     float MatRowMax_temp and skip;
     MatRowMax_row:=0;
     
     while( (MatRowMax_row<src->row) )
     {
         MatRowMax_temp:=(src->element[MatRowMax_row])[0];
         MatRowMax_col:=1;
         
         while( (MatRowMax_col<src->col) )
         {
             if((src->element[MatRowMax_row])[MatRowMax_col]>MatRowMax_temp) then 
             {
                 MatRowMax_temp:=(src->element[MatRowMax_row])[MatRowMax_col]
                 
             }
             else 
             {
                  skip 
             };
             MatRowMax_col:=MatRowMax_col+1
             
         };
         (dst->element[MatRowMax_row])[0]:=MatRowMax_temp;
         MatRowMax_row:=MatRowMax_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatSquare ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatSquare_row,MatSquare_col,return) and ( 
     int return<==0 and skip;
     int MatSquare_row,MatSquare_col and skip;
     MatSquare_row:=0;
     
     while( (MatSquare_row<src->row) )
     {
         MatSquare_col:=0;
         
         while( (MatSquare_col<src->col) )
         {
             (dst->element[MatSquare_row])[MatSquare_col]:=(src->element[MatSquare_row])[MatSquare_col]*(src->element[MatSquare_row])[MatSquare_col];
             MatSquare_col:=MatSquare_col+1
             
         };
         MatSquare_row:=MatSquare_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatSqrt ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatSqrt_row,MatSqrt_col,return) and ( 
     int return<==0 and skip;
     int MatSqrt_row,MatSqrt_col and skip;
     MatSqrt_row:=0;
     
     while( (MatSqrt_row<src->row) )
     {
         MatSqrt_col:=0;
         
         while( (MatSqrt_col<src->col) )
         {
             (dst->element[MatSqrt_row])[MatSqrt_col]:=sqrt((float)((src->element[MatSqrt_row])[MatSqrt_col]));
             MatSqrt_col:=MatSqrt_col+1
             
         };
         MatSqrt_row:=MatSqrt_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatExp ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatExp_row,MatExp_col,return) and ( 
     int return<==0 and skip;
     int MatExp_row,MatExp_col and skip;
     MatExp_row:=0;
     
     while( (MatExp_row<src->row) )
     {
         MatExp_col:=0;
         
         while( (MatExp_col<src->col) )
         {
             (dst->element[MatExp_row])[MatExp_col]:=(float)(exp((float)((src->element[MatExp_row])[MatExp_col])));
             MatExp_col:=MatExp_col+1
             
         };
         MatExp_row:=MatExp_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatVectorSub ( Mat *src,Mat *vector,Mat *dst,Mat* RValue )
 {
     frame(MatVectorSub_row,MatVectorSub_col,return) and ( 
     int return<==0 and skip;
     int MatVectorSub_row,MatVectorSub_col and skip;
     MatVectorSub_row:=0;
     
     while( (MatVectorSub_row<src->row) )
     {
         MatVectorSub_col:=0;
         
         while( (MatVectorSub_col<src->col) )
         {
             (dst->element[MatVectorSub_row])[MatVectorSub_col]:=(src->element[MatVectorSub_row])[MatVectorSub_col]-(vector->element[MatVectorSub_row])[0];
             MatVectorSub_col:=MatVectorSub_col+1
             
         };
         MatVectorSub_row:=MatVectorSub_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatVectorDiv ( Mat *src,Mat *vector,Mat *dst,Mat* RValue )
 {
     frame(MatVectorDiv_row,MatVectorDiv_col,return) and ( 
     int return<==0 and skip;
     int MatVectorDiv_row,MatVectorDiv_col and skip;
     MatVectorDiv_row:=0;
     
     while( (MatVectorDiv_row<src->row) )
     {
         MatVectorDiv_col:=0;
         
         while( (MatVectorDiv_col<src->col) )
         {
             (dst->element[MatVectorDiv_row])[MatVectorDiv_col]:=(src->element[MatVectorDiv_row])[MatVectorDiv_col]/ (vector->element[MatVectorDiv_row])[0];
             MatVectorDiv_col:=MatVectorDiv_col+1
             
         };
         MatVectorDiv_row:=MatVectorDiv_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatCopy ( Mat *src,Mat *dst )
 {
     frame(MatCopy_row,MatCopy_col) and ( 
     int MatCopy_row,MatCopy_col and skip;
     MatCopy_row:=0;
     
     while( (MatCopy_row<src->row) )
     {
         MatCopy_col:=0;
         
         while( (MatCopy_col<src->col) )
         {
             (dst->element[MatCopy_row])[MatCopy_col]:=(src->element[MatCopy_row])[MatCopy_col];
             MatCopy_col:=MatCopy_col+1
             
         };
         MatCopy_row:=MatCopy_row+1
         
     }
     )
     }; 
  function MatPlusCol ( Mat *src,Mat *dst )
 {
     frame(MatPlusCol_row,MatPlusCol_col) and ( 
     int MatPlusCol_row,MatPlusCol_col and skip;
     MatPlusCol_row:=0 and MatPlusCol_col:=0;
     while( (MatPlusCol_row<dst->row) )
     {
         (dst->element[MatPlusCol_row])[MatPlusCol_col]:=1;
         MatPlusCol_row:=MatPlusCol_row+1
         
     };
     MatPlusCol_row:=0;
     
     while( (MatPlusCol_row<src->row) )
     {
         MatPlusCol_col:=0;
         
         while( (MatPlusCol_col<src->col) )
         {
             (dst->element[MatPlusCol_row])[MatPlusCol_col+1]:=(src->element[MatPlusCol_row])[MatPlusCol_col];
             MatPlusCol_col:=MatPlusCol_col+1
             
         };
         MatPlusCol_row:=MatPlusCol_row+1
         
     }
     )
     }; 
  function MatPlusRow ( Mat *src,Mat *dst )
 {
     frame(MatPlusRow_row,MatPlusRow_col) and ( 
     int MatPlusRow_row,MatPlusRow_col and skip;
     MatPlusRow_row:=0 and MatPlusRow_col:=0;
     while( (MatPlusRow_col<dst->col) )
     {
         (dst->element[MatPlusRow_row])[MatPlusRow_col]:=0.0;
         MatPlusRow_col:=MatPlusRow_col+1
         
     };
     MatPlusRow_row:=0;
     
     while( (MatPlusRow_row<src->row) )
     {
         MatPlusRow_col:=0;
         
         while( (MatPlusRow_col<src->col) )
         {
             (dst->element[MatPlusRow_row+1])[MatPlusRow_col]:=(src->element[MatPlusRow_row])[MatPlusRow_col];
             MatPlusRow_col:=MatPlusRow_col+1
             
         };
         MatPlusRow_row:=MatPlusRow_row+1
         
     }
     )
     }; 
  function MatPlusRowConstant ( Mat *src,Mat *dst,float cst )
 {
     frame(MatPlusRowConstant_row,MatPlusRowConstant_col) and ( 
     int MatPlusRowConstant_row,MatPlusRowConstant_col and skip;
     MatPlusRowConstant_row:=0 and MatPlusRowConstant_col:=0;
     while( (MatPlusRowConstant_col<dst->col) )
     {
         (dst->element[MatPlusRowConstant_row])[MatPlusRowConstant_col]:=cst;
         MatPlusRowConstant_col:=MatPlusRowConstant_col+1
         
     };
     MatPlusRowConstant_row:=0;
     
     while( (MatPlusRowConstant_row<src->row) )
     {
         MatPlusRowConstant_col:=0;
         
         while( (MatPlusRowConstant_col<src->col) )
         {
             (dst->element[MatPlusRowConstant_row+1])[MatPlusRowConstant_col]:=(src->element[MatPlusRowConstant_row])[MatPlusRowConstant_col];
             MatPlusRowConstant_col:=MatPlusRowConstant_col+1
             
         };
         MatPlusRowConstant_row:=MatPlusRowConstant_row+1
         
     }
     )
     }; 
  function MatReduceRow ( Mat *src,Mat *dst )
 {
     frame(MatReduceRow_row,MatReduceRow_col) and ( 
     int MatReduceRow_row,MatReduceRow_col and skip;
     MatReduceRow_row:=1;
     
     while( (MatReduceRow_row<src->row) )
     {
         MatReduceRow_col:=0;
         
         while( (MatReduceRow_col<src->col) )
         {
             (dst->element[MatReduceRow_row-1])[MatReduceRow_col]:=(src->element[MatReduceRow_row])[MatReduceRow_col];
             MatReduceRow_col:=MatReduceRow_col+1
             
         };
         MatReduceRow_row:=MatReduceRow_row+1
         
     }
     )
     }; 
  function MatplusProduct ( Mat *src1,Mat *src2,Mat *dst,int hgt,Mat* RValue )
 {
     frame(MatplusProduct_i,MatplusProduct_j,MatplusProduct_k,return) and ( 
     int return<==0 and skip;
     int MatplusProduct_i,MatplusProduct_j,MatplusProduct_k and skip;
     MatplusProduct_i:=0;
     
     while( (MatplusProduct_i<hgt) )
     {
         MatplusProduct_j:=0;
         
         while( (MatplusProduct_j<dst[0].row) )
         {
             MatplusProduct_k:=0;
             
             while( (MatplusProduct_k<dst[0].col) )
             {
                 (dst[MatplusProduct_i].element[MatplusProduct_j])[MatplusProduct_k]:=(src1[MatplusProduct_i].element[MatplusProduct_j])[MatplusProduct_k]*(src2[MatplusProduct_i].element[MatplusProduct_j])[MatplusProduct_k];
                 MatplusProduct_k:=MatplusProduct_k+1
                 
             };
             MatplusProduct_j:=MatplusProduct_j+1
             
         };
         MatplusProduct_i:=MatplusProduct_i+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatplusShape ( Mat *mat,int mat_h )
 {
     output ("Mat ",mat_h,"x",mat->row,"x",mat->col,":\n") and skip
     
 };
 function MatplusZeros ( Mat *des,int des_h,Mat* RValue )
 {
     frame(MatplusZeros_i,return) and ( 
     int return<==0 and skip;
     int MatplusZeros_i and skip;
     MatplusZeros_i:=0;
     
     while( (MatplusZeros_i<des_h) )
     {
         MatZeros(&des[MatplusZeros_i],RValue);
         MatplusZeros_i:=MatplusZeros_i+1
         
     };
     return<==1 and RValue:=des;
     skip
     )
     }; 
      float *XVal<==NULL and skip;
     float *YVal<==NULL and skip;
     struct Predefine {
     int OnehotOptions and 
     int CompleteSampleNum and 
     int TrainSampleNum and 
     int TestSampleNum and 
     int Height and 
     int Width and 
     int Channel and 
     int ClassificationNum and 
     int LabelNum and 
     int HiddenLayerNum and 
     int *LayerType and 
     int *LayerParameters and 
     int ParametersTotal and 
     int WeightInitWayNum and 
     int *ActiFuncNumArray and 
     int LossFuncNum and 
     int BatchSize and 
     int OptFuncNum and 
     int *OptPara 
 };
 function DR_pow256 ( int a,int RValue )
 {
     frame(DR_pow256_sum,DR_pow256_i,return) and ( 
     int return<==0 and skip;
     int DR_pow256_sum<==1 and skip;
     int DR_pow256_i<==0 and skip;
     while( (DR_pow256_i<a) )
     {
         DR_pow256_sum:=DR_pow256_sum*256;
         DR_pow256_i:=DR_pow256_i+1
     };
     return<==1 and RValue:=DR_pow256_sum;
     skip
     )
     }; 
 function DR_intNormalize ( int NHWC )
 {
     frame(DR_intNormalize_mean,DR_intNormalize_std,DR_intNormalize_i,DR_intNormalize_s) and ( 
	 char DR_intNormalize_s[40] and skip;
	 //output(NHWC, " In Normalize.\n") and skip;
     double DR_intNormalize_mean<==0.0 and skip;
     double DR_intNormalize_std<==0.0 and skip;
	 //output("Begin Mean.\n") and skip;
     int DR_intNormalize_i and skip;
     DR_intNormalize_i:=0;
     //output("Begin Mean.1\n") and skip;
     while( (DR_intNormalize_i<NHWC) )
     {
		 //output(DR_intNormalize_i," Mean:", F2S(DR_intNormalize_mean,DR_intNormalize_s,RValue),"\n") and skip;
         DR_intNormalize_mean:=DR_intNormalize_mean+(double)XVal[DR_intNormalize_i]/ (NHWC);
         DR_intNormalize_i:=DR_intNormalize_i+1
         
     };
	 //output("End Mean.\n") and skip;

     DR_intNormalize_i:=0;
     
     while( (DR_intNormalize_i<NHWC) )
     {
         DR_intNormalize_std:=DR_intNormalize_std+(double)((XVal[DR_intNormalize_i]-DR_intNormalize_mean)*(XVal[DR_intNormalize_i]-DR_intNormalize_mean))/ (NHWC);
         DR_intNormalize_i:=DR_intNormalize_i+1
         
     };
	 //output("InSqrt.\n") and skip;
     DR_intNormalize_std:=sqrt(DR_intNormalize_std);
     DR_intNormalize_i:=0;
     
	 //output("Normalize Process.\n") and skip;
     while( (DR_intNormalize_i<NHWC) )
     {
         XVal[DR_intNormalize_i]:=(XVal[DR_intNormalize_i]-DR_intNormalize_mean)/ DR_intNormalize_std;
         DR_intNormalize_i:=DR_intNormalize_i+1
         
     }
     )
     }; 
function DR_readInt(FILE *fp,int bit,int RValue)
{
    frame(buf,res,i,tmp,pows,return) and (
        int return<==0 and skip;
        char buf[255] and skip;
        int res<==0 and skip;
        int i<==bit-1 and skip;
        int tmp and skip;
        int pows and skip;
        while(i>=0)
        {
            fread(buf,1,1,fp) and skip;
            tmp:=buf[0];
            if(tmp<0) then{
                tmp:=tmp+256;
                skip
            }
            else{
                skip
            };
            pows:=DR_pow256(i);
            res:=res+pows*tmp;
            i:=i-1
        };
		/*if(bit=4) then {
			output(res," ") and skip
		}
		else{
			skip
		};*/
        return<==1 and RValue:=res;
        skip
    )
};
function DR_loadMINST ( int clsf,int OneHot,int chan,Predefine *pdf,int RValue )
{
    frame(fx1,fx2,fy1,fy2,DR_loadMINST_i,DR_loadMINST_tmp,return) and ( 
    int return<==0 and skip;
	//output("In read.\n") and skip;
	 FILE *fx1<==fopen("C:\\Users\\asd18\\Documents\\gitee\\MC8.0\\MC8.0\\dataset\\train-images.idx3-ubyte","rb") and skip;
     FILE *fx2<==fopen("C:\\Users\\asd18\\Documents\\gitee\\MC8.0\\MC8.0\\dataset\\t10k-images.idx3-ubyte","rb") and skip;
     FILE *fy1<==fopen("C:\\Users\\asd18\\Documents\\gitee\\MC8.0\\MC8.0\\dataset\\train-labels.idx1-ubyte","rb") and skip;
     FILE *fy2<==fopen("C:\\Users\\asd18\\Documents\\gitee\\MC8.0\\MC8.0\\dataset\\t10k-labels.idx1-ubyte","rb") and skip;
    if(fx1=NULL) then 
    {
	output("1\n") and skip;
        return<==1 and RValue:=1;
        skip
    }
    else 
    {
        skip 
    };
    if(return=0)   then 
    {
        if(fx2=NULL) then 
        {
	        output("2\n") and skip;
            return<==1 and RValue:=2;
            skip
        }
        else 
        {
            skip 
        };
        if(return=0)   then 
        {
            if(fy1=NULL) then 
            {
		        output("3\n") and skip;
                return<==1 and RValue:=3;
                skip
            }
            else 
            {
                skip 
            };
            if(return=0)   then 
            {
                if(fy2=NULL) then 
                {
			        output("4\n") and skip;
                    return<==1 and RValue:=4;
                    skip
                }
                else 
                {
                    skip 
                };// wrong happen before
                if(return=0)   then 
                {
                    DR_readInt(fx1,4,RValue);
                    DR_readInt(fx2,4,RValue);
                    DR_readInt(fy1,4,RValue);
                    DR_readInt(fy2,4,RValue);
                    pdf->TrainSampleNum:=DR_readInt(fx1,4,RValue);
                    DR_readInt(fy1,4,RValue);
                    pdf->TestSampleNum:=DR_readInt(fx2,4,RValue);
                    DR_readInt(fy2,4,RValue);
                    pdf->CompleteSampleNum:=pdf->TrainSampleNum+pdf->TestSampleNum;
                    pdf->Height:=DR_readInt(fx1,4,RValue);
                    DR_readInt(fx2,4,RValue);
                    pdf->Width:=DR_readInt(fx1,4,RValue);
                    DR_readInt(fx2,4,RValue);
                    pdf->Channel:=chan;
                    pdf->ClassificationNum:=clsf;
                    pdf->OnehotOptions:=1;
                    if(pdf->OnehotOptions=0) then 
                    {
                        pdf->LabelNum:=1
                    }
                    else
                    {
                        if(pdf->OnehotOptions=1) then 
                        {
                            pdf->LabelNum:=pdf->ClassificationNum
                        }
                        else
                        {
                            output ("Input parr wrong: onehot should be 0 or 1.\n") and skip;
                            return<==1 and RValue:=5;
                            skip
                        }
                    };
                    if(return=0)  then
                    {
                        XVal:=(float *)malloc(pdf->CompleteSampleNum*pdf->Height*pdf->Width*pdf->Channel*sizeof(float));
                        YVal:=(float *)malloc(pdf->LabelNum*pdf->CompleteSampleNum*sizeof(float));
                        int DR_loadMINST_i and skip;
                        float DR_loadMINST_tmp and skip;
                        DR_loadMINST_i:=0;
                        
                        while( (DR_loadMINST_i<pdf->TrainSampleNum*pdf->Height*pdf->Width*pdf->Channel) )
                        {
                            DR_loadMINST_tmp:=(float)DR_readInt(fx1,1,RValue);
                            * (XVal+DR_loadMINST_i):=DR_loadMINST_tmp;
                            DR_loadMINST_i:=DR_loadMINST_i+1
                            
                        };
                        DR_loadMINST_i:=pdf->TrainSampleNum*pdf->Height*pdf->Width*pdf->Channel;
                        
                        while( (DR_loadMINST_i<pdf->CompleteSampleNum*pdf->Height*pdf->Width*pdf->Channel) )
                        {
                            DR_loadMINST_tmp:=(float)DR_readInt(fx2,1,RValue);
                            * (XVal+DR_loadMINST_i):=DR_loadMINST_tmp;
                            DR_loadMINST_i:=DR_loadMINST_i+1
                            
                        };
                        DR_loadMINST_i:=0;
                        
                        while( (DR_loadMINST_i<pdf->LabelNum*pdf->TrainSampleNum) )
                        {
                            DR_loadMINST_tmp:=(float)DR_readInt(fy1,1,RValue);
                            * (YVal+DR_loadMINST_i):=DR_loadMINST_tmp;
                            DR_loadMINST_i:=DR_loadMINST_i+1
                            
                        };
                        DR_loadMINST_i:=pdf->LabelNum*pdf->TrainSampleNum;
                        
                        while( (DR_loadMINST_i<pdf->LabelNum*pdf->CompleteSampleNum) )
                        {
                            DR_loadMINST_tmp:=(float)DR_readInt(fy2,1,RValue);
                            * (YVal+DR_loadMINST_i):=DR_loadMINST_tmp;
                            DR_loadMINST_i:=DR_loadMINST_i+1
                            
                        };
						fclose(fx1) and skip;
                        fclose(fx2) and skip;
                        fclose(fy1) and skip;
                        fclose(fy2) and skip;
                        int NHWC <== pdf->CompleteSampleNum*pdf->Height*pdf->Width*pdf->Channel and skip;
                        DR_intNormalize(NHWC);
                        return<==1 and RValue:=0;
                        skip
                    }
                    else
                    {
                        skip
                    }
                }
                else
                {
                    skip
                }
            }
            else
            {
                skip
            }
        }
        else
        {
            skip
        }
    }
    else
    {
        skip
    };
	skip
    )
}; 
      struct DataSet {
     Mat CompleteFeatureDataSet and 
     Mat CompleteLabelDataSet and 
     Mat CompleteTrainFeature and 
     Mat CompleteTrainLabel and 
     Mat *BatchTrainFeature and 
     Mat *BatchTrainLabel and 
     Mat TestFeature and 
     Mat TestLabel and 
     int CompleteSampleNum and 
     int TrainSampleNum and 
     int TestSampleNum and 
     int SampleChannels and 
     int SampleRow and 
     int SampleCol and 
     int ClassificationNum and 
     int LabelNum and 
     int BatchSize and 
     int BatchNum and 
     int remainder 
 };
 struct Layer {
 int LayerType and 
 int PaddingMode and 
 int ActiFuncNum and 
 int KernelSize[2] and 
 int Stride[2] and 
 Mat *OriginMat and 
 Mat KernelMat and 
 Mat WeightMat and 
 Mat *SumMat and 
 Mat *ActiMat and 
 Mat *DeriMat and 
 Mat *DeltaMat and 
 Mat NablaMat and 
 int OutH and 
 int OutW and 
 int OutC 
 };
 struct CNN {
 int sampleCapacity and 
 int SampleRow and 
 int SampleCol and 
 int SampleCha and 
 int HiddenLayerNum and 
 int WeightInitWayNum and 
 Layer *Layers and 
 Mat OnehotMat and 
 int ClassificationNum and 
 int LossFuncNum 
 };
 function InitPredefine ( Predefine *pdf )
 {
     pdf->OnehotOptions:=-1;
     pdf->CompleteSampleNum:=-1;
     pdf->TrainSampleNum:=-1;
     pdf->TestSampleNum:=-1;
     pdf->Width:=-1;
     pdf->Height:=-1;
     pdf->Channel:=-1;
     pdf->ClassificationNum:=-1;
     pdf->LabelNum:=-1;
     pdf->HiddenLayerNum:=-1;
     pdf->LayerType:=NULL;
     pdf->LayerParameters:=NULL;
     pdf->ParametersTotal:=-1;
     pdf->WeightInitWayNum:=-1;
     pdf->ActiFuncNumArray:=NULL;
     pdf->LossFuncNum:=-1;
     pdf->BatchSize:=-1
     
 };
 function InitDataSet ( DataSet *ds )
 {
     ds->CompleteFeatureDataSet.element:=NULL;
     ds->CompleteLabelDataSet.element:=NULL;
     ds->CompleteTrainFeature.element:=NULL;
     ds->CompleteTrainLabel.element:=NULL;
     ds->BatchTrainFeature:=NULL;
     ds->BatchTrainLabel:=NULL;
     ds->TestFeature.element:=NULL;
     ds->TestLabel.element:=NULL;
     ds->CompleteSampleNum:=-1;
     ds->TrainSampleNum:=-1;
     ds->TestSampleNum:=-1;
     ds->SampleChannels:=-1;
     ds->SampleRow:=-1;
     ds->SampleCol:=-1;
     ds->ClassificationNum:=-1;
     ds->LabelNum:=-1;
     ds->BatchSize:=-1;
     ds->BatchNum:=-1;
     ds->remainder:=-1
     
 };
 function InitLayer ( Layer *ncp )
 {
     ncp->LayerType:=-1;
     ncp->PaddingMode:=-1;
     ncp->ActiFuncNum:=-1;
     ncp->KernelSize[0]:=-1;
     ncp->KernelSize[1]:=-1;
     ncp->KernelSize[2]:=-1;
     ncp->KernelSize[3]:=-1;
     ncp->Stride[0]:=-1;
     ncp->Stride[1]:=-1;
     ncp->OriginMat:=NULL;
     ncp->KernelMat.element:=NULL;
     ncp->WeightMat.element:=NULL;
     ncp->SumMat:=NULL;
     ncp->ActiMat:=NULL;
     ncp->DeriMat:=NULL;
     ncp->OutH:=-1;
     ncp->OutW:=-1;
     ncp->OutC:=-1
     
 };
 function InitCNN ( CNN *cnn )
 {
     cnn->sampleCapacity:=-1;
     cnn->SampleCol:=-1;
     cnn->SampleRow:=-1;
     cnn->SampleCha:=-1;
     cnn->HiddenLayerNum:=-1;
     cnn->WeightInitWayNum:=-1;
     cnn->Layers:=NULL;
     cnn->OnehotMat.element:=NULL
     
 };
 function DumpIntArray ( int *array,int n )
 {
     frame(DumpIntArray_i) and ( 
     int DumpIntArray_i and skip;
     DumpIntArray_i:=0;
     
     while( (DumpIntArray_i<n) )
     {
         output (array[DumpIntArray_i],"\t","\t") and skip;
         DumpIntArray_i:=DumpIntArray_i+1
         
     };
     output ("\n") and skip
     )
     }; 
  function DumpFloatArray ( float *array,int n )
 {
     frame(DumpFloatArray_str,DumpFloatArray_i) and ( 
     char DumpFloatArray_str[40] and skip;
     int DumpFloatArray_i and skip;
     DumpFloatArray_i:=0;
     
     while( (DumpFloatArray_i<n) )
     {
         output (F2S(array[DumpFloatArray_i],DumpFloatArray_str,RValue)) and skip;
         output ("\t") and skip;
         DumpFloatArray_i:=DumpFloatArray_i+1
         
     };
     output ("\n") and skip
     )
     }; 
  function DumpPredefine ( Predefine pdf,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("============================================================== Predefine Dump =================================================================\n") and skip;
     if(pdf.CompleteSampleNum=-1) then 
     {
         output ("\t\t\tPredefine parameter 'CompleteSampleNum' uninitialized!!!\n") and skip;
         return<==1 and RValue:=-1;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         output ("CompleteSampleNum:\t",pdf.CompleteSampleNum,"\n") and skip;
         if(pdf.TrainSampleNum=-1) then 
         {
             output ("\t\t\tPredefine parameter 'TrainSampleNum' uninitialized!!!\n") and skip;
             return<==1 and RValue:=-1;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             output ("TrainSampleNum:\t\t",pdf.TrainSampleNum,"\n") and skip;
             if(pdf.TestSampleNum=-1) then 
             {
                 output ("\t\t\tPredefine parameter 'TestSampleNum' uninitialized!!!\n") and skip;
                 return<==1 and RValue:=-1;
                 skip
                 
             }
             else 
             {
                  skip 
             };
             if(return=0)   then 
             {
                 output ("TestSampleNum:\t\t",pdf.TestSampleNum,"\n") and skip;
                 if(pdf.Height=-1) then 
                 {
                     output ("\t\t\tPredefine parameter 'Height' uninitialized!!!\n") and skip;
                     return<==1 and RValue:=-1;
                     skip
                     
                 }
                 else 
                 {
                      skip 
                 };
                 if(return=0)   then 
                 {
                     output ("Height:\t\t\t",pdf.Height,"\n") and skip;
                     if(pdf.Width=-1) then 
                     {
                         output ("\t\t\tPredefine parameter 'Width' uninitialized!!!\n") and skip;
                         return<==1 and RValue:=-1;
                         skip
                         
                     }
                     else 
                     {
                          skip 
                     };
                     if(return=0)   then 
                     {
                         output ("Width:\t\t\t",pdf.Width,"\n") and skip;
                         if(pdf.Channel=-1) then 
                         {
                             output ("\t\t\tPredefine parameter 'Channel' uninitialized!!!\n") and skip;
                             return<==1 and RValue:=-1;
                             skip
                             
                         }
                         else 
                         {
                              skip 
                         };
                         if(return=0)   then 
                         {
                             output ("Channel:\t\t",pdf.Channel,"\n") and skip;
                             if(pdf.ClassificationNum=-1) then 
                             {
                                 output ("\t\t\tPredefine parameter 'ClassificationNum' uninitialized!!!\n") and skip;
                                 return<==1 and RValue:=-1;
                                 skip
                                 
                             }
                             else 
                             {
                                  skip 
                             };
                             if(return=0)   then 
                             {
                                 output ("ClassificationNum:\t",pdf.ClassificationNum,"\n") and skip;
                                 if(pdf.OnehotOptions=-1) then 
                                 {
                                     output ("\t\t\tPredefine parameter 'OnehotOptions' uninitialized!!!\n") and skip;
                                     return<==1 and RValue:=-1;
                                     skip
                                     
                                 }
                                 else 
                                 {
                                      skip 
                                 };
                                 if(return=0)   then 
                                 {
                                     output ("OnehotOptions:\t\t",pdf.OnehotOptions,"\n") and skip;
                                     if(pdf.LabelNum=-1) then 
                                     {
                                         output ("\t\t\tPredefine parameter 'LabelNum' uninitialized!!!\n") and skip;
                                         return<==1 and RValue:=-1;
                                         skip
                                         
                                     }
                                     else 
                                     {
                                          skip 
                                     };
                                     if(return=0)   then 
                                     {
                                         output ("LabelNum:\t\t",pdf.LabelNum,"\n") and skip;
                                         if(pdf.HiddenLayerNum=-1) then 
                                         {
                                             output ("\t\t\tPredefine parameter 'HiddenLayerNum' uninitialized!!!\n") and skip;
                                             return<==1 and RValue:=-1;
                                             skip
                                             
                                         }
                                         else 
                                         {
                                              skip 
                                         };
                                         if(return=0)   then 
                                         {
                                             output ("HiddenLayerNum:\t\t",pdf.HiddenLayerNum,"\n") and skip;
                                             if(pdf.WeightInitWayNum=-1) then 
                                             {
                                                 output ("\t\t\tPredefine parameter 'WeightInitWayNum' uninitialized!!!\n") and skip;
                                                 return<==1 and RValue:=-1;
                                                 skip
                                                 
                                             }
                                             else 
                                             {
                                                  skip 
                                             };
                                             if(return=0)   then 
                                             {
                                                 output ("WeightInitWayNum:\t",pdf.WeightInitWayNum,"\n") and skip;
                                                 if(pdf.LossFuncNum=-1) then 
                                                 {
                                                     output ("\t\t\tPredefine parameter 'LossFuncNum' uninitialized!!!\n") and skip;
                                                     return<==1 and RValue:=-1;
                                                     skip
                                                     
                                                 }
                                                 else 
                                                 {
                                                      skip 
                                                 };
                                                 if(return=0)   then 
                                                 {
                                                     output ("LossFuncNum:\t\t",pdf.LossFuncNum,"\n") and skip;
                                                     if(pdf.BatchSize=-1) then 
                                                     {
                                                         output ("\t\t\tPredefine parameter 'BatchSize' uninitialized!!!\n") and skip;
                                                         return<==1 and RValue:=-1;
                                                         skip
                                                         
                                                     }
                                                     else 
                                                     {
                                                          skip 
                                                     };
                                                     if(return=0)   then 
                                                     {
                                                         output ("BatchSize:\t\t",pdf.BatchSize,"\n") and skip;
                                                         if(pdf.LayerType=NULL) then 
                                                         {
                                                             output ("\t\t\tPredefine parameter 'LayerType' uninitialized!!!\n") and skip;
                                                             return<==1 and RValue:=-1;
                                                             skip
                                                             
                                                         }
                                                         else 
                                                         {
                                                              skip 
                                                         };
                                                         if(return=0)   then 
                                                         {
                                                             output ("LayerType:\n") and skip;
                                                             DumpIntArray(pdf.LayerType,pdf.HiddenLayerNum+2);
                                                             if(pdf.ParametersTotal=-1) then 
                                                             {
                                                                 output ("\t\t\tPredefine parameter 'ParametersTotal' uninitialized!!!\n") and skip;
                                                                 return<==1 and RValue:=-1;
                                                                 skip
                                                                 
                                                             }
                                                             else 
                                                             {
                                                                  skip 
                                                             };
                                                             if(return=0)   then 
                                                             {
                                                                 output ("ParametersTotal:\t",pdf.ParametersTotal,"\n") and skip;
                                                                 if(pdf.LayerParameters=NULL) then 
                                                                 {
                                                                     output ("\t\t\tPredefine parameter 'LayerParameters' uninitialized!!!\n") and skip;
                                                                     return<==1 and RValue:=-1;
                                                                     skip
                                                                     
                                                                 }
                                                                 else 
                                                                 {
                                                                      skip 
                                                                 };
                                                                 if(return=0)   then 
                                                                 {
                                                                     output ("LayerParameters:\n") and skip;
                                                                     DumpIntArray(pdf.LayerParameters,pdf.ParametersTotal);
                                                                     if(pdf.ActiFuncNumArray=NULL) then 
                                                                     {
                                                                         output ("\t\t\tPredefine parameter 'ActiFuncNumArray' uninitialized!!!\n") and skip;
                                                                         return<==1 and RValue:=-1;
                                                                         skip
                                                                         
                                                                     }
                                                                     else 
                                                                     {
                                                                          skip 
                                                                     };
                                                                     if(return=0)   then 
                                                                     {
                                                                         output ("ActiFuncNumArray:\n") and skip;
                                                                         DumpIntArray(pdf.ActiFuncNumArray,pdf.HiddenLayerNum+2);
                                                                         output ("========================================================== Predefine Dump Finished ============================================================\n") and skip;
                                                                         return<==1 and RValue:=0;
                                                                         skip
                                                                     }
                                                                     else
                                                                     {
                                                                         skip
                                                                     }
                                                                 }
                                                                 else
                                                                 {
                                                                     skip
                                                                 }
                                                             }
                                                             else
                                                             {
                                                                 skip
                                                             }
                                                         }
                                                         else
                                                         {
                                                             skip
                                                         }
                                                     }
                                                     else
                                                     {
                                                         skip
                                                     }
                                                 }
                                                 else
                                                 {
                                                     skip
                                                 }
                                             }
                                             else
                                             {
                                                 skip
                                             }
                                         }
                                         else
                                         {
                                             skip
                                         }
                                     }
                                     else
                                     {
                                         skip
                                     }
                                 }
                                 else
                                 {
                                     skip
                                 }
                             }
                             else
                             {
                                 skip
                             }
                         }
                         else
                         {
                             skip
                         }
                     }
                     else
                     {
                         skip
                     }
                 }
                 else
                 {
                     skip
                 }
             }
             else
             {
                 skip
             }
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function DumpDataSet ( DataSet dst,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("=============================================================== DataSet Dump ==================================================================\n") and skip;
     if(dst.CompleteSampleNum=-1) then 
     {
         output ("\t\t\tDataSet parameter 'CompleteSampleNum' uninitialized!!!\n") and skip;
         return<==1 and RValue:=-1;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         output ("CompleteSampleNum:\t",dst.CompleteSampleNum,"\n") and skip;
         if(dst.TrainSampleNum=-1) then 
         {
             output ("\t\t\tDataSet parameter 'TrainSampleNum' uninitialized!!!\n") and skip;
             return<==1 and RValue:=-1;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             output ("TrainSampleNum:\t\t",dst.TrainSampleNum,"\n") and skip;
             if(dst.TestSampleNum=-1) then 
             {
                 output ("\t\t\tDataSet parameter 'TestSampleNum' uninitialized!!!\n") and skip;
                 return<==1 and RValue:=-1;
                 skip
                 
             }
             else 
             {
                  skip 
             };
             if(return=0)   then 
             {
                 output ("TestSampleNum:\t\t",dst.TestSampleNum,"\n") and skip;
                 if(dst.SampleRow=-1) then 
                 {
                     output ("\t\t\tDataSet parameter 'SampleRow' uninitialized!!!\n") and skip;
                     return<==1 and RValue:=-1;
                     skip
                     
                 }
                 else 
                 {
                      skip 
                 };
                 if(return=0)   then 
                 {
                     output ("SampleRow:\t\t",dst.SampleRow,"\n") and skip;
                     if(dst.SampleCol=-1) then 
                     {
                         output ("\t\t\tDataSet parameter 'SampleCol' uninitialized!!!\n") and skip;
                         return<==1 and RValue:=-1;
                         skip
                         
                     }
                     else 
                     {
                          skip 
                     };
                     if(return=0)   then 
                     {
                         output ("SampleCol:\t\t",dst.SampleCol,"\n") and skip;
                         if(dst.SampleChannels=-1) then 
                         {
                             output ("\t\t\tDataSet parameter 'SampleChannels' uninitialized!!!\n") and skip;
                             return<==1 and RValue:=-1;
                             skip
                             
                         }
                         else 
                         {
                              skip 
                         };
                         if(return=0)   then 
                         {
                             output ("SampleChannels:\t\t",dst.SampleChannels,"\n") and skip;
                             if(dst.ClassificationNum=-1) then 
                             {
                                 output ("\t\t\tDataSet parameter 'ClassificationNum' uninitialized!!!\n") and skip;
                                 return<==1 and RValue:=-1;
                                 skip
                                 
                             }
                             else 
                             {
                                  skip 
                             };
                             if(return=0)   then 
                             {
                                 output ("ClassificationNum:\t",dst.ClassificationNum,"\n") and skip;
                                 if(dst.LabelNum=-1) then 
                                 {
                                     output ("\t\t\tDataSet parameter 'LabelNum' uninitialized!!!\n") and skip;
                                     return<==1 and RValue:=-1;
                                     skip
                                     
                                 }
                                 else 
                                 {
                                      skip 
                                 };
                                 if(return=0)   then 
                                 {
                                     output ("LabelNum:\t\t",dst.LabelNum,"\n") and skip;
                                     if(dst.BatchNum=-1) then 
                                     {
                                         output ("\t\t\tDataSet parameter 'BatchNum' uninitialized!!!\n") and skip;
                                         return<==1 and RValue:=-1;
                                         skip
                                         
                                     }
                                     else 
                                     {
                                          skip 
                                     };
                                     if(return=0)   then 
                                     {
                                         output ("BatchNum:\t\t",dst.BatchNum,"\n") and skip;
                                         if(dst.BatchSize=-1) then 
                                         {
                                             output ("\t\t\tDataSet parameter 'BatchSize' uninitialized!!!\n") and skip;
                                             return<==1 and RValue:=-1;
                                             skip
                                             
                                         }
                                         else 
                                         {
                                              skip 
                                         };
                                         if(return=0)   then 
                                         {
                                             output ("BatchSize:\t\t",dst.BatchSize,"\n") and skip;
                                             if(dst.remainder=-1) then 
                                             {
                                                 output ("\t\t\tDataSet parameter 'remainder' uninitialized!!!\n") and skip;
                                                 return<==1 and RValue:=-1;
                                                 skip
                                                 
                                             }
                                             else 
                                             {
                                                  skip 
                                             };
                                             if(return=0)   then 
                                             {
                                                 output ("remainder:\t\t",dst.remainder,"\n") and skip;
                                                 if(dst.CompleteFeatureDataSet.element=NULL) then 
                                                 {
                                                     output ("\t\t\tDataSet parameter 'CompleteFeatureDataSet' uninitialized!!!\n") and skip;
                                                     return<==1 and RValue:=-1;
                                                     skip
                                                     
                                                 }
                                                 else 
                                                 {
                                                      skip 
                                                 };
                                                 if(return=0)   then 
                                                 {
                                                     output ("CompleteFeatureDataSet:\t[",dst.CompleteFeatureDataSet.row,",",dst.CompleteFeatureDataSet.col,"]\n") and skip;
                                                     if(dst.CompleteLabelDataSet.element=NULL) then 
                                                     {
                                                         output ("\t\t\tDataSet parameter 'CompleteLabelDataSet' uninitialized!!!\n") and skip;
                                                         return<==1 and RValue:=-1;
                                                         skip
                                                         
                                                     }
                                                     else 
                                                     {
                                                          skip 
                                                     };
                                                     if(return=0)   then 
                                                     {
                                                         output ("CompleteLabelDataSet:\t[",dst.CompleteLabelDataSet.row,",",dst.CompleteLabelDataSet.col,"]\n") and skip;
                                                         if(dst.CompleteTrainFeature.element=NULL) then 
                                                         {
                                                             output ("\t\t\tDataSet parameter 'CompleteTrainFeature' uninitialized!!!\n") and skip;
                                                             return<==1 and RValue:=-1;
                                                             skip
                                                             
                                                         }
                                                         else 
                                                         {
                                                              skip 
                                                         };
                                                         if(return=0)   then 
                                                         {
                                                             output ("CompleteTrainFeature:\t[",dst.CompleteTrainFeature.row,",",dst.CompleteTrainFeature.col,"]\n") and skip;
                                                             if(dst.CompleteTrainLabel.element=NULL) then 
                                                             {
                                                                 output ("\t\t\tDataSet parameter 'CompleteTrainLabel' uninitialized!!!\n") and skip;
                                                                 return<==1 and RValue:=-1;
                                                                 skip
                                                                 
                                                             }
                                                             else 
                                                             {
                                                                  skip 
                                                             };
                                                             if(return=0)   then 
                                                             {
                                                                 output ("CompleteTrainLabel:\t[",dst.CompleteTrainLabel.row,",",dst.CompleteTrainLabel.col,"]\n") and skip;
                                                                 if(dst.TestFeature.element=NULL) then 
                                                                 {
                                                                     output ("\t\t\tDataSet parameter 'TestFeature' uninitialized!!!\n") and skip;
                                                                     return<==1 and RValue:=-1;
                                                                     skip
                                                                     
                                                                 }
                                                                 else 
                                                                 {
                                                                      skip 
                                                                 };
                                                                 if(return=0)   then 
                                                                 {
                                                                     output ("TestFeature:\t\t[",dst.TestFeature.row,",",dst.TestFeature.col,"]\n") and skip;
                                                                     if(dst.TestLabel.element=NULL) then 
                                                                     {
                                                                         output ("\t\t\tDataSet parameter 'TestLabel' uninitialized!!!\n") and skip;
                                                                         return<==1 and RValue:=-1;
                                                                         skip
                                                                         
                                                                     }
                                                                     else 
                                                                     {
                                                                          skip 
                                                                     };
                                                                     if(return=0)   then 
                                                                     {
                                                                         output ("TestLabel:\t\t[",dst.TestLabel.row,",",dst.TestLabel.col,"]\n") and skip;
                                                                         output ("========================================================== DataSet Dump Finished ==============================================================\n") and skip;
                                                                         return<==1 and RValue:=0;
                                                                         skip
                                                                     }
                                                                     else
                                                                     {
                                                                         skip
                                                                     }
                                                                 }
                                                                 else
                                                                 {
                                                                     skip
                                                                 }
                                                             }
                                                             else
                                                             {
                                                                 skip
                                                             }
                                                         }
                                                         else
                                                         {
                                                             skip
                                                         }
                                                     }
                                                     else
                                                     {
                                                         skip
                                                     }
                                                 }
                                                 else
                                                 {
                                                     skip
                                                 }
                                             }
                                             else
                                             {
                                                 skip
                                             }
                                         }
                                         else
                                         {
                                             skip
                                         }
                                     }
                                     else
                                     {
                                         skip
                                     }
                                 }
                                 else
                                 {
                                     skip
                                 }
                             }
                             else
                             {
                                 skip
                             }
                         }
                         else
                         {
                             skip
                         }
                     }
                     else
                     {
                         skip
                     }
                 }
                 else
                 {
                     skip
                 }
             }
             else
             {
                 skip
             }
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function DumpInputLayer ( Layer in,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("\tInput:\t\t[",in.OutH,",",in.OutW,",",in.OutC,"]\n") and skip;
     output ("ActiMat[",in.ActiMat[0].row,",",in.ActiMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpFullConnLayer ( Layer fc,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("Layers:\t NeuronNum \t ActiNum\n") and skip;
     output ("   FcLayer\t ",fc.OutC," \t\t ",fc.ActiFuncNum," \n") and skip;
     output ("OriginMat[",fc.OriginMat[0].row,",",fc.OriginMat[0].col,"]\n") and skip;
     output ("KernelMat[",fc.KernelMat.row,",",fc.KernelMat.col,"]\tWeightMat[",fc.WeightMat.row,",",fc.WeightMat.col,"]\tNablaMat[",fc.NablaMat.row,",",fc.NablaMat.col,"]\n") and skip;
     output ("SumMat[",fc.SumMat[0].row,",",fc.SumMat[0].col,"]\tActiMat[",fc.ActiMat[0].row,",",fc.ActiMat[0].col,"]\tDeriMat[",fc.DeriMat[0].row,",",fc.DeriMat[0].col,"]\tDeltaMat[",fc.DeltaMat[0].row,",",fc.DeltaMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpConvLayer ( Layer cv,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("Layers:\t Pad \t ActiNum \t Kernel \t Stride \t OutSize \n") and skip;
     output ("    CLayer\t ",cv.PaddingMode," \t ",cv.ActiFuncNum," \t\t [",cv.KernelSize[0],",",cv.KernelSize[1],"] \t\t [",cv.Stride[0],",",cv.Stride[1],"] \t\t [",cv.OutH,",",cv.OutW,",",cv.OutC,"]\n") and skip;
     output ("KernelMat[",cv.KernelMat.row,",",cv.KernelMat.col,"]\tWeightMat[",cv.WeightMat.row,",",cv.WeightMat.col,"]\tNablaMat[",cv.NablaMat.row,",",cv.NablaMat.col,"]\n") and skip;
     output ("OriginMat[",cv.OriginMat[0].row,",",cv.OriginMat[0].col,"]\n") and skip;
     output ("SumMat[",cv.SumMat[0].row,",",cv.SumMat[0].col,"]\tActiMat[",cv.ActiMat[0].row,",",cv.ActiMat[0].col,"]\tDeriMat[",cv.DeriMat[0].row,",",cv.DeriMat[0].col,"]\tDeltaMat[",cv.DeltaMat[0].row,",",cv.DeltaMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpDeConvLayer ( Layer dec,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("Layers:\t Pad \t ActiNum \t Kernel \t Stride \t OutSize \n") and skip;
     output ("  deCLayer\t ",dec.PaddingMode," \t ",dec.ActiFuncNum," \t\t [",dec.KernelSize[0],",",dec.KernelSize[1],"] \t\t [",dec.Stride[0],",",dec.Stride[1],"] \t\t [",dec.OutH,",",dec.OutW,",",dec.OutC,"]\n") and skip;
     output ("KernelMat[",dec.KernelMat.row,",",dec.KernelMat.col,"]\tNablaMat[",dec.NablaMat.row,",",dec.NablaMat.col,"]\n") and skip;
     output ("OriginMat[",dec.OriginMat[0].row,",",dec.OriginMat[0].col,"]\n") and skip;
     output ("SumMat[",dec.SumMat[0].row,",",dec.SumMat[0].col,"]\tActiMat[",dec.ActiMat[0].row,",",dec.ActiMat[0].col,"]\tDeriMat[",dec.DeriMat[0].row,",",dec.DeriMat[0].col,"]\tDeltaMat[",dec.DeltaMat[0].row,",",dec.DeltaMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpMaxPoolLayer ( Layer mp,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("Layers:\t Pad \t Kernel \t Stride \t OutSize \n") and skip;
     output ("   MPLayer\t ",mp.PaddingMode," \t [",mp.KernelSize[0],",",mp.KernelSize[1],"] \t\t [",mp.Stride[0],",",mp.Stride[1],"] \t\t [",mp.OutH,",",mp.OutW,",",mp.OutC,"]\n") and skip;
     output ("KernelMat[",mp.KernelMat.row,",",mp.KernelMat.col,"]\n") and skip;
     output ("OriginMat[",mp.OriginMat[0].row,",",mp.OriginMat[0].col,"]\n") and skip;
     output ("ActiMat[",mp.ActiMat[0].row,",",mp.ActiMat[0].col,"]\tDeltaMat[",mp.DeltaMat[0].row,",",mp.DeltaMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpAvePoolLayer ( Layer ap,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("Layers:\t Pad \t Kernel \t Stride \t OutSize \n") and skip;
     output ("   APLayer\t ",ap.PaddingMode," \t [",ap.KernelSize[0],",",ap.KernelSize[1],"] \t\t [",ap.Stride[0],",",ap.Stride[1],"] \t\t [",ap.OutH,",",ap.OutW,",",ap.OutC,"]\n") and skip;
     output ("KernelMat[",ap.KernelMat.row,",",ap.KernelMat.col,"]\n") and skip;
     output ("OriginMat[",ap.OriginMat[0].row,",",ap.OriginMat[0].col,"]\n") and skip;
     output ("ActiMat[",ap.ActiMat[0].row,",",ap.ActiMat[0].col,"]\tDeltaMat[",ap.DeltaMat[0].row,",",ap.DeltaMat[0].col,"]\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpLayersofCNN ( CNN cnn,int RValue )
 {
     frame(DumpLayersofCNN_i,return) and ( 
     int return<==0 and skip;
     output ("-----------------------Layers---------------------\n") and skip;
     DumpInputLayer(cnn.Layers[0],RValue);
     int DumpLayersofCNN_i and skip;
     DumpLayersofCNN_i:=1;
     
     while( (DumpLayersofCNN_i<cnn.HiddenLayerNum+2) )
     {
         if(cnn.Layers[DumpLayersofCNN_i].LayerType=0) then 
         {
             output (DumpLayersofCNN_i," "," ") and skip;
             DumpFullConnLayer(cnn.Layers[DumpLayersofCNN_i],RValue)
             
         }
         else 
         {
              skip 
         };
         if(cnn.Layers[DumpLayersofCNN_i].LayerType=1) then 
         {
             output (DumpLayersofCNN_i," "," ") and skip;
             DumpConvLayer(cnn.Layers[DumpLayersofCNN_i],RValue)
             
         }
         else 
         {
              skip 
         };
         if(cnn.Layers[DumpLayersofCNN_i].LayerType=2) then 
         {
             output (DumpLayersofCNN_i," "," ") and skip;
             DumpDeConvLayer(cnn.Layers[DumpLayersofCNN_i],RValue)
             
         }
         else 
         {
              skip 
         };
         if(cnn.Layers[DumpLayersofCNN_i].LayerType=3) then 
         {
             output (DumpLayersofCNN_i," "," ") and skip;
             DumpMaxPoolLayer(cnn.Layers[DumpLayersofCNN_i],RValue)
             
         }
         else 
         {
              skip 
         };
         if(cnn.Layers[DumpLayersofCNN_i].LayerType=4) then 
         {
             output (DumpLayersofCNN_i," "," ") and skip;
             DumpAvePoolLayer(cnn.Layers[DumpLayersofCNN_i],RValue)
             
         }
         else 
         {
              skip 
         };
         DumpLayersofCNN_i:=DumpLayersofCNN_i+1
         
     };
     output ("--------------------------------------------------\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpCNN ( CNN cnn,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     output ("================================================================= CNN Dump ====================================================================\n") and skip;
     if(cnn.sampleCapacity=-1) then 
     {
         output ("\t\t\tDataSet parameter 'sampleCapacity' uninitialized!!!\n") and skip;
         return<==1 and RValue:=-1;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         output ("sampleCapacity:\t\t",cnn.sampleCapacity,"\n") and skip;
         if(cnn.SampleRow=-1) then 
         {
             output ("\t\t\tDataSet parameter 'SampleRow' uninitialized!!!\n") and skip;
             return<==1 and RValue:=-1;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             output ("SampleRow:\t\t",cnn.SampleRow,"\n") and skip;
             if(cnn.SampleCol=-1) then 
             {
                 output ("\t\t\tDataSet parameter 'SampleCol' uninitialized!!!\n") and skip;
                 return<==1 and RValue:=-1;
                 skip
                 
             }
             else 
             {
                  skip 
             };
             if(return=0)   then 
             {
                 output ("SampleCol:\t\t",cnn.SampleCol,"\n") and skip;
                 if(cnn.SampleCha=-1) then 
                 {
                     output ("\t\t\tDataSet parameter 'SampleCha' uninitialized!!!\n") and skip;
                     return<==1 and RValue:=-1;
                     skip
                     
                 }
                 else 
                 {
                      skip 
                 };
                 if(return=0)   then 
                 {
                     output ("SampleCha:\t\t",cnn.SampleCha,"\n") and skip;
                     if(cnn.HiddenLayerNum=-1) then 
                     {
                         output ("\t\t\tDataSet parameter 'HiddenLayerNum' uninitialized!!!\n") and skip;
                         return<==1 and RValue:=-1;
                         skip
                         
                     }
                     else 
                     {
                          skip 
                     };
                     if(return=0)   then 
                     {
                         output ("HiddenLayerNum:\t\t",cnn.HiddenLayerNum,"\n") and skip;
                         if(cnn.WeightInitWayNum=-1) then 
                         {
                             output ("\t\t\tDataSet parameter 'WeightInitWayNum' uninitialized!!!\n") and skip;
                             return<==1 and RValue:=-1;
                             skip
                             
                         }
                         else 
                         {
                              skip 
                         };
                         if(return=0)   then 
                         {
                             output ("WeightInitWayNum:\t",cnn.WeightInitWayNum,"\n") and skip;
                             if(cnn.ClassificationNum=-1) then 
                             {
                                 output ("\t\t\tDataSet parameter 'ClassificationNum' uninitialized!!!\n") and skip;
                                 return<==1 and RValue:=-1;
                                 skip
                                 
                             }
                             else 
                             {
                                  skip 
                             };
                             if(return=0)   then 
                             {
                                 output ("ClassificationNum:\t",cnn.ClassificationNum,"\n") and skip;
                                 if(cnn.LossFuncNum=-1) then 
                                 {
                                     output ("\t\t\tDataSet parameter 'LossFuncNum' uninitialized!!!\n") and skip;
                                     return<==1 and RValue:=-1;
                                     skip
                                     
                                 }
                                 else 
                                 {
                                      skip 
                                 };
                                 if(return=0)   then 
                                 {
                                     output ("LossFuncNum:\t\t",cnn.LossFuncNum,"\n") and skip;
                                     if(cnn.OnehotMat.element=NULL) then 
                                     {
                                         output ("\t\t\tDataSet parameter 'OnehotMat' uninitialized!!!\n") and skip;
                                         return<==1 and RValue:=-1;
                                         skip
                                         
                                     }
                                     else 
                                     {
                                          skip 
                                     };
                                     if(return=0)   then 
                                     {
                                         output ("OnehotMat:\t\t[",cnn.OnehotMat.row,",",cnn.OnehotMat.col,"]\n") and skip;
                                         if(cnn.Layers=NULL) then 
                                         {
                                             output ("\t\t\tDataSet parameter 'Layers' uninitialized!!!\n") and skip;
                                             return<==1 and RValue:=-1;
                                             skip
                                             
                                         }
                                         else 
                                         {
                                              skip 
                                         };
                                         if(return=0)   then 
                                         {
                                             DumpLayersofCNN(cnn,RValue);
                                             output ("============================================================ CNN Dump Finished ================================================================\n") and skip;
                                             return<==1 and RValue:=0;
                                             skip
                                         }
                                         else
                                         {
                                             skip
                                         }
                                     }
                                     else
                                     {
                                         skip
                                     }
                                 }
                                 else
                                 {
                                     skip
                                 }
                             }
                             else
                             {
                                 skip
                             }
                         }
                         else
                         {
                             skip
                         }
                     }
                     else
                     {
                         skip
                     }
                 }
                 else
                 {
                     skip
                 }
             }
             else
             {
                 skip
             }
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function DumpKWofCNN ( CNN cnn,int RValue )
 {
     frame(DumpKWofCNN_i,return) and ( 
     int return<==0 and skip;
     output ("--------Dump KernelMat and WeightMat of CNN--------\n") and skip;
     int DumpKWofCNN_i and skip;
     DumpKWofCNN_i:=1;
     
     while( (DumpKWofCNN_i<cnn.HiddenLayerNum+2) )
     {
         output (DumpKWofCNN_i," Layers:\n"," Layers:\n") and skip;
         MatDump(&cnn.Layers[DumpKWofCNN_i].KernelMat);
         if(cnn.Layers[DumpKWofCNN_i].LayerType=0 OR cnn.Layers[DumpKWofCNN_i].LayerType=1) then 
         {
             skip
             
         }
         else 
         {
              skip 
         };
         DumpKWofCNN_i:=DumpKWofCNN_i+1
         
     };
     output ("----------------------------------------------------\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpMatplusHWCC ( Mat *matp,int hgh,int RValue )
 {
     frame(DumpMatplusHWCC_i,DumpMatplusHWCC_j,DumpMatplusHWCC_k,DumpMatplusHWCC_str,return) and ( 
     int return<==0 and skip;
     MatplusShape(matp,hgh);
     int DumpMatplusHWCC_i,DumpMatplusHWCC_j,DumpMatplusHWCC_k and skip;
     char DumpMatplusHWCC_str[40] and skip;
     DumpMatplusHWCC_i:=0;
     
     while( (DumpMatplusHWCC_i<matp[0].col) )
     {
         output ("Channel ",DumpMatplusHWCC_i,":\n") and skip;
         DumpMatplusHWCC_j:=0;
         
         while( (DumpMatplusHWCC_j<hgh) )
         {
             DumpMatplusHWCC_k:=0;
             
             while( (DumpMatplusHWCC_k<matp[0].row) )
             {
                 output (F2S((matp[DumpMatplusHWCC_j].element[DumpMatplusHWCC_k])[DumpMatplusHWCC_i],DumpMatplusHWCC_str,RValue)," "," ") and skip;
                 DumpMatplusHWCC_k:=DumpMatplusHWCC_k+1
                 
             };
             output ("\n") and skip;
             DumpMatplusHWCC_j:=DumpMatplusHWCC_j+1
             
         };
         DumpMatplusHWCC_i:=DumpMatplusHWCC_i+1
         
     };
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function DumpMatplusHWCH ( Mat *mp,int hgh,int RValue )
 {
     frame(DumpMatplusHWCH_i,DumpMatplusHWCH_j,DumpMatplusHWCH_k,DumpMatplusHWCH_str,return) and ( 
     int return<==0 and skip;
     int DumpMatplusHWCH_i,DumpMatplusHWCH_j,DumpMatplusHWCH_k and skip;
     char DumpMatplusHWCH_str[40] and skip;
     MatplusShape(mp,hgh);
     DumpMatplusHWCH_i:=0;
     
     while( (DumpMatplusHWCH_i<hgh) )
     {
         output ("Height ",DumpMatplusHWCH_i," :\n") and skip;
         DumpMatplusHWCH_j:=0;
         
         while( (DumpMatplusHWCH_j<mp[0].row) )
         {
             DumpMatplusHWCH_k:=0;
             
             while( (DumpMatplusHWCH_k<mp[0].col) )
             {
                 output (F2S((mp[DumpMatplusHWCH_i].element[DumpMatplusHWCH_j])[DumpMatplusHWCH_k],DumpMatplusHWCH_str,RValue)," "," ") and skip;
                 DumpMatplusHWCH_k:=DumpMatplusHWCH_k+1
                 
             };
             output ("\n") and skip;
             DumpMatplusHWCH_j:=DumpMatplusHWCH_j+1
             
         };
         DumpMatplusHWCH_i:=DumpMatplusHWCH_i+1
         
     };
     output ("\n") and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function LoadParaFromPredefine ( Predefine pdf,DataSet *dst,CNN *cnn )
 {
     dst->CompleteSampleNum:=pdf.CompleteSampleNum;
     dst->TrainSampleNum:=pdf.TrainSampleNum;
     dst->TestSampleNum:=pdf.TestSampleNum;
     dst->SampleRow:=pdf.Height;
     dst->SampleCol:=pdf.Width;
     dst->SampleChannels:=pdf.Channel;
     dst->ClassificationNum:=pdf.ClassificationNum;
     dst->LabelNum:=pdf.LabelNum;
     dst->BatchSize:=pdf.BatchSize;
     dst->BatchNum:=(dst->TrainSampleNum-1)/ dst->BatchSize+1;
     dst->remainder:=dst->TrainSampleNum % dst->BatchSize;
     cnn->sampleCapacity:=pdf.CompleteSampleNum;
     cnn->SampleRow:=pdf.Height;
     cnn->SampleCol:=pdf.Width;
     cnn->SampleCha:=pdf.Channel;
     cnn->HiddenLayerNum:=pdf.HiddenLayerNum;
     cnn->WeightInitWayNum:=pdf.WeightInitWayNum;
     cnn->ClassificationNum:=pdf.ClassificationNum;
     cnn->LossFuncNum:=pdf.LossFuncNum
     
 };
 function CreateDataSetSpace ( DataSet *dst )
 {
     frame(CreateDataSetSpace_i) and ( 
     MatCreate(&dst->CompleteFeatureDataSet,dst->CompleteSampleNum,dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
     MatZeros(&dst->CompleteFeatureDataSet,RValue);
     MatCreate(&dst->CompleteLabelDataSet,dst->CompleteSampleNum,dst->LabelNum,RValue);
     MatZeros(&dst->CompleteLabelDataSet,RValue);
     MatCreate(&dst->CompleteTrainFeature,dst->TrainSampleNum,dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
     MatZeros(&dst->CompleteTrainFeature,RValue);
     MatCreate(&dst->CompleteTrainLabel,dst->TrainSampleNum,dst->LabelNum,RValue);
     MatZeros(&dst->CompleteTrainLabel,RValue);
     dst->BatchTrainFeature:=(Mat *)malloc(dst->BatchNum*sizeof(Mat));
     dst->BatchTrainLabel:=(Mat *)malloc(dst->BatchNum*sizeof(Mat));
     if(dst->BatchTrainFeature=NULL) then 
     {
         output ("BatchTrainFeature create fail!\n") and skip
         
     }
     else 
     {
          skip 
     };
     if(dst->BatchTrainLabel=NULL) then 
     {
         output ("BatchTrainLabel create fail!\n") and skip
         
     }
     else 
     {
          skip 
     };
     int CreateDataSetSpace_i and skip;
     CreateDataSetSpace_i:=0;
     
     while( (CreateDataSetSpace_i<dst->BatchNum) )
     {
         if(CreateDataSetSpace_i=dst->BatchNum-1 AND dst->remainder!=0) then 
         {
             MatCreate(&(dst->BatchTrainFeature)[CreateDataSetSpace_i],dst->remainder,dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
             MatZeros(&(dst->BatchTrainFeature)[CreateDataSetSpace_i],RValue);
             MatCreate(&(dst->BatchTrainLabel)[CreateDataSetSpace_i],dst->remainder,dst->LabelNum,RValue);
             MatZeros(&(dst->BatchTrainLabel)[CreateDataSetSpace_i],RValue)
             
         }
         else
         {
             MatCreate(&(dst->BatchTrainFeature)[CreateDataSetSpace_i],dst->BatchSize,dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
             MatZeros(&(dst->BatchTrainFeature)[CreateDataSetSpace_i],RValue);
             MatCreate(&(dst->BatchTrainLabel)[CreateDataSetSpace_i],dst->BatchSize,dst->LabelNum,RValue);
             MatZeros(&(dst->BatchTrainLabel)[CreateDataSetSpace_i],RValue)
         };
         CreateDataSetSpace_i:=CreateDataSetSpace_i+1
         
     };
     MatCreate(&dst->TestFeature,dst->TestSampleNum,dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
     MatZeros(&dst->TestFeature,RValue);
     MatCreate(&dst->TestLabel,dst->TestSampleNum,dst->LabelNum,RValue);
     MatZeros(&dst->TestLabel,RValue)
     )
     }; 
  function FeatureLoading ( DataSet *dst )
 {
     frame(FeatureLoading_i) and ( 
     MatSetVal(&dst->CompleteFeatureDataSet,XVal,RValue);
     MatSetVal(&dst->CompleteTrainFeature,XVal,RValue);
     int FeatureLoading_i and skip;
     FeatureLoading_i:=0;
     
     while( (FeatureLoading_i<dst->BatchNum) )
     {
         MatSetVal(&dst->BatchTrainFeature[FeatureLoading_i],XVal+FeatureLoading_i*dst->BatchSize*dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue);
         FeatureLoading_i:=FeatureLoading_i+1
         
     };
     MatSetVal(&dst->TestFeature,XVal+dst->TrainSampleNum*dst->SampleRow*dst->SampleCol*dst->SampleChannels,RValue)
     )
     }; 
  function LabelLoading ( DataSet *dst )
 {
     frame(LabelLoading_i) and ( 
     MatSetVal(&dst->CompleteLabelDataSet,YVal,RValue);
     MatSetVal(&dst->CompleteTrainLabel,YVal,RValue);
     int LabelLoading_i and skip;
     LabelLoading_i:=0;
     
     while( (LabelLoading_i<dst->BatchNum) )
     {
         MatSetVal(&dst->BatchTrainLabel[LabelLoading_i],YVal+LabelLoading_i*dst->BatchSize,RValue);
         LabelLoading_i:=LabelLoading_i+1
         
     };
     MatSetVal(&dst->TestLabel,YVal+dst->TrainSampleNum,RValue)
     )
     }; 
  function LabelLoadingOnehot ( DataSet *dst )
 {
     frame(LabelLoadingOnehot_i) and ( 
     int LabelLoadingOnehot_i and skip;
     LabelLoadingOnehot_i:=0;
     
     while( (LabelLoadingOnehot_i<dst->CompleteSampleNum) )
     {
         (dst->CompleteLabelDataSet.element[LabelLoadingOnehot_i])[(int)YVal[LabelLoadingOnehot_i]]:=1.0;
         LabelLoadingOnehot_i:=LabelLoadingOnehot_i+1
         
     };
     LabelLoadingOnehot_i:=0;
     
     while( (LabelLoadingOnehot_i<dst->TrainSampleNum) )
     {
         (dst->CompleteTrainLabel.element[LabelLoadingOnehot_i])[(int)YVal[LabelLoadingOnehot_i]]:=1.0;
         (dst->BatchTrainLabel[LabelLoadingOnehot_i/ dst->BatchSize].element[LabelLoadingOnehot_i % dst->BatchSize])[(int)YVal[LabelLoadingOnehot_i]]:=1.0;
         LabelLoadingOnehot_i:=LabelLoadingOnehot_i+1
         
     };
     LabelLoadingOnehot_i:=0;
     
     while( (LabelLoadingOnehot_i<dst->TestSampleNum) )
     {
         (dst->TestLabel.element[LabelLoadingOnehot_i])[(int)YVal[LabelLoadingOnehot_i+dst->TrainSampleNum]]:=1.0;
         LabelLoadingOnehot_i:=LabelLoadingOnehot_i+1
         
     }
     )
     }; 
  function DataConstruct ( DataSet *dst )
 {
     CreateDataSetSpace(dst);
     FeatureLoading(dst);
     if(dst->LabelNum=1) then 
     {
         LabelLoading(dst)
     }
     else
     {
         LabelLoadingOnehot(dst)
     }
     
 };
 function SpaceCreateLayers ( CNN *cnn,Layer* RValue )
 {
     frame(SpaceCreateLayers_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateLayers_i and skip;
     cnn->Layers:=(Layer *)malloc((cnn->HiddenLayerNum+2)*sizeof(Layer));
     SpaceCreateLayers_i:=0;
     
     while( (SpaceCreateLayers_i<cnn->HiddenLayerNum+2) )
     {
         InitLayer(&cnn->Layers[SpaceCreateLayers_i]);
         SpaceCreateLayers_i:=SpaceCreateLayers_i+1
         
     };
     return<==1 and RValue:=cnn->Layers;
     skip
     )
     }; 
  function LoadinPara2Layers ( CNN *cnn,Predefine pdf,int RValue )
 {
     frame(LoadinPara2Layers_cnt,LoadinPara2Layers_i,return) and ( 
     int return<==0 and skip;
     cnn->Layers[0].OutH:=cnn->SampleRow;
     cnn->Layers[0].OutW:=cnn->SampleCol;
     cnn->Layers[0].OutC:=cnn->SampleCha;
     int LoadinPara2Layers_cnt<==0 and skip;
     int LoadinPara2Layers_i and skip;
     LoadinPara2Layers_i:=1;
     
     while( return=0 AND   (LoadinPara2Layers_i<cnn->HiddenLayerNum+2) )
     {
         if(pdf.LayerType[LoadinPara2Layers_i]=0) then 
         {
             cnn->Layers[LoadinPara2Layers_i].LayerType:=0;
             cnn->Layers[LoadinPara2Layers_i].OutC:=pdf.LayerParameters[LoadinPara2Layers_cnt];
             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
             cnn->Layers[LoadinPara2Layers_i].ActiFuncNum:=pdf.LayerParameters[LoadinPara2Layers_cnt];
             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
             cnn->Layers[LoadinPara2Layers_i].OutH:=1;
             cnn->Layers[LoadinPara2Layers_i].OutW:=1
             
         }
         else
         {
             if(pdf.LayerType[LoadinPara2Layers_i]=1) then 
             {
                 cnn->Layers[LoadinPara2Layers_i].LayerType:=1;
                 cnn->Layers[LoadinPara2Layers_i].PaddingMode:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].KernelSize[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].KernelSize[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].Stride[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].Stride[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].OutC:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 cnn->Layers[LoadinPara2Layers_i].ActiFuncNum:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                 LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                 if(cnn->Layers[LoadinPara2Layers_i].PaddingMode=0) then 
                 {
                     cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-cnn->Layers[LoadinPara2Layers_i].KernelSize[0])/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                     cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-cnn->Layers[LoadinPara2Layers_i].KernelSize[1])/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                 }
                 else
                 {
                     cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                     cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                 }
             }
             else
             {
                 if(pdf.LayerType[LoadinPara2Layers_i]=2) then 
                 {
                     cnn->Layers[LoadinPara2Layers_i].LayerType:=2;
                     cnn->Layers[LoadinPara2Layers_i].PaddingMode:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].KernelSize[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].KernelSize[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].Stride[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].Stride[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].OutC:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].ActiFuncNum:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                     LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                     cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH-1)*cnn->Layers[LoadinPara2Layers_i].Stride[0]+cnn->Layers[LoadinPara2Layers_i].KernelSize[0];
                     cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW-1)*cnn->Layers[LoadinPara2Layers_i].Stride[1]+cnn->Layers[LoadinPara2Layers_i].KernelSize[1]
                 }
                 else
                 {
                     if(pdf.LayerType[LoadinPara2Layers_i]=3) then 
                     {
                         cnn->Layers[LoadinPara2Layers_i].LayerType:=3;
                         cnn->Layers[LoadinPara2Layers_i].PaddingMode:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                         LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                         cnn->Layers[LoadinPara2Layers_i].KernelSize[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                         LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                         cnn->Layers[LoadinPara2Layers_i].KernelSize[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                         LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                         cnn->Layers[LoadinPara2Layers_i].Stride[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                         LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                         cnn->Layers[LoadinPara2Layers_i].Stride[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                         LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                         cnn->Layers[LoadinPara2Layers_i].OutC:=cnn->Layers[LoadinPara2Layers_i-1].OutC;
                         if(cnn->Layers[LoadinPara2Layers_i].PaddingMode=0) then 
                         {
                             cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-cnn->Layers[LoadinPara2Layers_i].KernelSize[0])/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                             cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-cnn->Layers[LoadinPara2Layers_i].KernelSize[1])/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                         }
                         else
                         {
                             cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                             cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                         }
                     }
                     else
                     {
                         if(pdf.LayerType[LoadinPara2Layers_i]=4) then 
                         {
                             cnn->Layers[LoadinPara2Layers_i].LayerType:=4;
                             cnn->Layers[LoadinPara2Layers_i].PaddingMode:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                             cnn->Layers[LoadinPara2Layers_i].KernelSize[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                             cnn->Layers[LoadinPara2Layers_i].KernelSize[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                             cnn->Layers[LoadinPara2Layers_i].Stride[0]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                             cnn->Layers[LoadinPara2Layers_i].Stride[1]:=pdf.LayerParameters[LoadinPara2Layers_cnt];
                             LoadinPara2Layers_cnt:=LoadinPara2Layers_cnt+1;
                             cnn->Layers[LoadinPara2Layers_i].OutC:=cnn->Layers[LoadinPara2Layers_i-1].OutC;
                             if(cnn->Layers[LoadinPara2Layers_i].PaddingMode=0) then 
                             {
                                 cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-cnn->Layers[LoadinPara2Layers_i].KernelSize[0])/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                                 cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-cnn->Layers[LoadinPara2Layers_i].KernelSize[1])/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                             }
                             else
                             {
                                 cnn->Layers[LoadinPara2Layers_i].OutH:=(cnn->Layers[LoadinPara2Layers_i-1].OutH+cnn->Layers[LoadinPara2Layers_i].Stride[0]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[0];
                                 cnn->Layers[LoadinPara2Layers_i].OutW:=(cnn->Layers[LoadinPara2Layers_i-1].OutW+cnn->Layers[LoadinPara2Layers_i].Stride[1]-1)/ cnn->Layers[LoadinPara2Layers_i].Stride[1]
                             }
                         }
                         else
                         {
                             return<==1 and RValue:=-1;
                             skip
                         }
                     }
                 }
             }
         };
         if(return=0)  then
         {
             LoadinPara2Layers_i:=LoadinPara2Layers_i+1
         }
         else
         {
             skip
         }
         
     };
     if(return=0)   then 
     {
         return<==1 and RValue:=0;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function SpaceCreateInputLayer ( Layer *input$,Layer* RValue )
 {
     frame(SpaceCreateInputLayer_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateInputLayer_i and skip;
     input$->ActiMat:=(Mat *)malloc(input$->OutH*sizeof(Mat));
     SpaceCreateInputLayer_i:=0;
     
     while( (SpaceCreateInputLayer_i<input$->OutH) )
     {
         MatCreate(&input$->ActiMat[SpaceCreateInputLayer_i],input$->OutW,input$->OutC,RValue);
         SpaceCreateInputLayer_i:=SpaceCreateInputLayer_i+1
         
     };
     return<==1 and RValue:=input$;
     skip
     )
     }; 
  function SpaceCreateFullConnLayer ( Layer *fc,int InH,int InW,int InC,Layer* RValue )
 {
     frame(SpaceCreateFullConnLayer_InDim,return) and ( 
     int return<==0 and skip;
     int SpaceCreateFullConnLayer_InDim<==InH*InW*InC and skip;
     fc->OriginMat:=(Mat *)malloc(sizeof(Mat));
     MatCreate(&fc->OriginMat[0],1,SpaceCreateFullConnLayer_InDim+1,RValue);
     MatCreate(&fc->KernelMat,SpaceCreateFullConnLayer_InDim,fc->OutC,RValue);
     MatCreate(&fc->WeightMat,SpaceCreateFullConnLayer_InDim+1,fc->OutC,RValue);
     MatCreate(&fc->NablaMat,SpaceCreateFullConnLayer_InDim+1,fc->OutC,RValue);
     MatZeros(&fc->NablaMat,RValue);
     fc->SumMat:=(Mat *)malloc(sizeof(Mat));
     MatCreate(&fc->SumMat[0],1,fc->OutC,RValue);
     fc->ActiMat:=(Mat *)malloc(sizeof(Mat));
     MatCreate(&fc->ActiMat[0],1,fc->OutC,RValue);
     fc->DeriMat:=(Mat *)malloc(sizeof(Mat));
     MatCreate(&fc->DeriMat[0],1,fc->OutC,RValue);
     fc->DeltaMat:=(Mat *)malloc(sizeof(Mat));
     MatCreate(&fc->DeltaMat[0],1,fc->OutC,RValue);
     return<==1 and RValue:=fc;
     skip
     )
     }; 
  function SpaceCreateConvLayer ( Layer *cv,int InH,int InW,int InC,Layer* RValue )
 {
     frame(SpaceCreateConvLayer_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateConvLayer_i and skip;
     MatCreate(&cv->KernelMat,cv->KernelSize[0]*cv->KernelSize[1]*InC,cv->OutC,RValue);
     MatCreate(&cv->WeightMat,cv->KernelSize[0]*cv->KernelSize[1]*InC+1,cv->OutC,RValue);
     MatCreate(&cv->NablaMat,cv->KernelSize[0]*cv->KernelSize[1]*InC+1,cv->OutC,RValue);
     MatZeros(&cv->NablaMat,RValue);
     cv->OriginMat:=(Mat *)malloc(cv->OutH*sizeof(Mat));
     cv->SumMat:=(Mat *)malloc(cv->OutH*sizeof(Mat));
     cv->ActiMat:=(Mat *)malloc(cv->OutH*sizeof(Mat));
     cv->DeriMat:=(Mat *)malloc(cv->OutH*sizeof(Mat));
     cv->DeltaMat:=(Mat *)malloc(cv->OutH*sizeof(Mat));
     SpaceCreateConvLayer_i:=0;
     
     while( (SpaceCreateConvLayer_i<cv->OutH) )
     {
         MatCreate(&cv->OriginMat[SpaceCreateConvLayer_i],cv->OutW,cv->KernelSize[0]*cv->KernelSize[1]*InC+1,RValue);
         MatCreate(&cv->SumMat[SpaceCreateConvLayer_i],cv->OutW,cv->OutC,RValue);
         MatCreate(&cv->ActiMat[SpaceCreateConvLayer_i],cv->OutW,cv->OutC,RValue);
         MatCreate(&cv->DeriMat[SpaceCreateConvLayer_i],cv->OutW,cv->OutC,RValue);
         MatCreate(&cv->DeltaMat[SpaceCreateConvLayer_i],cv->OutW,cv->OutC,RValue);
         SpaceCreateConvLayer_i:=SpaceCreateConvLayer_i+1
         
     };
     return<==1 and RValue:=cv;
     skip
     )
     }; 
  function SpaceCreateDeConvLayer ( Layer *dec,int InH,int InW,int InC,Layer* RValue )
 {
     frame(SpaceCreateDeConvLayer_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateDeConvLayer_i and skip;
     MatCreate(&dec->KernelMat,InC,dec->KernelSize[0]*dec->KernelSize[1]*dec->OutC,RValue);
     MatCreate(&dec->NablaMat,InC,dec->KernelSize[0]*dec->KernelSize[1]*dec->OutC,RValue);
     dec->OriginMat:=(Mat *)malloc(dec->OutH*sizeof(Mat));
     dec->SumMat:=(Mat *)malloc(dec->OutH*sizeof(Mat));
     dec->ActiMat:=(Mat *)malloc(dec->OutH*sizeof(Mat));
     dec->DeriMat:=(Mat *)malloc(dec->OutH*sizeof(Mat));
     dec->DeltaMat:=(Mat *)malloc(dec->OutH*sizeof(Mat));
     MatZeros(&dec->NablaMat,RValue);
     SpaceCreateDeConvLayer_i:=0;
     
     while( (SpaceCreateDeConvLayer_i<dec->OutH) )
     {
         MatCreate(&dec->OriginMat[SpaceCreateDeConvLayer_i],InW,dec->KernelSize[0]*dec->KernelSize[1]*dec->OutC,RValue);
         MatCreate(&dec->SumMat[SpaceCreateDeConvLayer_i],dec->OutW,dec->OutC,RValue);
         MatCreate(&dec->ActiMat[SpaceCreateDeConvLayer_i],dec->OutW,dec->OutC,RValue);
         MatCreate(&dec->DeriMat[SpaceCreateDeConvLayer_i],dec->OutW,dec->OutC,RValue);
         MatCreate(&dec->DeltaMat[SpaceCreateDeConvLayer_i],dec->OutW,dec->OutC,RValue);
         SpaceCreateDeConvLayer_i:=SpaceCreateDeConvLayer_i+1
         
     };
     return<==1 and RValue:=dec;
     skip
     )
     }; 
  function SpaceCreateMaxPoolLayer ( Layer *mp,int InH,int InW,int InC,Layer* RValue )
 {
     frame(SpaceCreateMaxPoolLayer_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateMaxPoolLayer_i and skip;
     MatCreate(&mp->KernelMat,mp->OutH*mp->OutW,mp->OutC,RValue);
     mp->OriginMat:=(Mat *)malloc(mp->OutH*sizeof(Mat));
     mp->ActiMat:=(Mat *)malloc(mp->OutH*sizeof(Mat));
     mp->DeltaMat:=(Mat *)malloc(mp->OutH*sizeof(Mat));
     SpaceCreateMaxPoolLayer_i:=0;
     
     while( (SpaceCreateMaxPoolLayer_i<mp->OutH) )
     {
         MatCreate(&mp->OriginMat[SpaceCreateMaxPoolLayer_i],mp->OutW,mp->KernelSize[0]*mp->KernelSize[1]*InC,RValue);
         MatCreate(&mp->ActiMat[SpaceCreateMaxPoolLayer_i],mp->OutW,mp->OutC,RValue);
         MatCreate(&mp->DeltaMat[SpaceCreateMaxPoolLayer_i],mp->OutW,mp->OutC,RValue);
         SpaceCreateMaxPoolLayer_i:=SpaceCreateMaxPoolLayer_i+1
         
     };
     return<==1 and RValue:=mp;
     skip
     )
     }; 
  function SpaceCreateAvePoolLayer ( Layer *ap,int InH,int InW,int InC,Layer* RValue )
 {
     frame(SpaceCreateAvePoolLayer_i,return) and ( 
     int return<==0 and skip;
     int SpaceCreateAvePoolLayer_i and skip;
     MatCreate(&ap->KernelMat,ap->KernelSize[0]*ap->KernelSize[1]*InC,ap->OutC,RValue);
     ap->OriginMat:=(Mat *)malloc(ap->OutH*sizeof(Mat));
     ap->ActiMat:=(Mat *)malloc(ap->OutH*sizeof(Mat));
     ap->DeltaMat:=(Mat *)malloc(ap->OutH*sizeof(Mat));
     SpaceCreateAvePoolLayer_i:=0;
     
     while( (SpaceCreateAvePoolLayer_i<ap->OutH) )
     {
         MatCreate(&ap->OriginMat[SpaceCreateAvePoolLayer_i],ap->OutW,ap->KernelSize[0]*ap->KernelSize[1]*InC,RValue);
         MatCreate(&ap->ActiMat[SpaceCreateAvePoolLayer_i],ap->OutW,ap->OutC,RValue);
         MatCreate(&ap->DeltaMat[SpaceCreateAvePoolLayer_i],ap->OutW,ap->OutC,RValue);
         SpaceCreateAvePoolLayer_i:=SpaceCreateAvePoolLayer_i+1
         
     };
     return<==1 and RValue:=ap;
     skip
     )
     }; 
  function CreateNNMatSpace ( CNN *cnn,int RValue )
 {
     frame(CreateNNMatSpace_i,return,continue) and ( 
     int continue<==0 and skip;
     int return<==0 and skip;
     int CreateNNMatSpace_i and skip;
     SpaceCreateInputLayer(&cnn->Layers[0],RValue);
     continue<==0 and skip;
     CreateNNMatSpace_i:=1;
     
     while( (CreateNNMatSpace_i<cnn->HiddenLayerNum+2) )
     {
          continue<==0 and skip;
         if(cnn->Layers[CreateNNMatSpace_i].LayerType=0) then 
         {
             SpaceCreateFullConnLayer(&cnn->Layers[CreateNNMatSpace_i],cnn->Layers[CreateNNMatSpace_i-1].OutH,cnn->Layers[CreateNNMatSpace_i-1].OutW,cnn->Layers[CreateNNMatSpace_i-1].OutC,RValue);
             continue<==1 and skip;
             CreateNNMatSpace_i:=CreateNNMatSpace_i+1
         }
         else 
         {
              skip 
         };
         if(continue=0)   then 
         {
             if(cnn->Layers[CreateNNMatSpace_i].LayerType=1) then 
             {
                 SpaceCreateConvLayer(&cnn->Layers[CreateNNMatSpace_i],cnn->Layers[CreateNNMatSpace_i-1].OutH,cnn->Layers[CreateNNMatSpace_i-1].OutW,cnn->Layers[CreateNNMatSpace_i-1].OutC,RValue);
                 continue<==1 and skip;
                 CreateNNMatSpace_i:=CreateNNMatSpace_i+1
             }
             else 
             {
                  skip 
             };
             if(continue=0)   then 
             {
                 if(cnn->Layers[CreateNNMatSpace_i].LayerType=2) then 
                 {
                     SpaceCreateDeConvLayer(&cnn->Layers[CreateNNMatSpace_i],cnn->Layers[CreateNNMatSpace_i-1].OutH,cnn->Layers[CreateNNMatSpace_i-1].OutW,cnn->Layers[CreateNNMatSpace_i-1].OutC,RValue);
                     continue<==1 and skip;
                     CreateNNMatSpace_i:=CreateNNMatSpace_i+1
                 }
                 else 
                 {
                      skip 
                 };
                 if(continue=0)   then 
                 {
                     if(cnn->Layers[CreateNNMatSpace_i].LayerType=3) then 
                     {
                         SpaceCreateMaxPoolLayer(&cnn->Layers[CreateNNMatSpace_i],cnn->Layers[CreateNNMatSpace_i-1].OutH,cnn->Layers[CreateNNMatSpace_i-1].OutW,cnn->Layers[CreateNNMatSpace_i-1].OutC,RValue);
                         continue<==1 and skip;
                         CreateNNMatSpace_i:=CreateNNMatSpace_i+1
                     }
                     else 
                     {
                          skip 
                     };
                     if(continue=0)   then 
                     {
                         if(cnn->Layers[CreateNNMatSpace_i].LayerType=4) then 
                         {
                             SpaceCreateAvePoolLayer(&cnn->Layers[CreateNNMatSpace_i],cnn->Layers[CreateNNMatSpace_i-1].OutH,cnn->Layers[CreateNNMatSpace_i-1].OutW,cnn->Layers[CreateNNMatSpace_i-1].OutC,RValue);
                             continue<==1 and skip;
                             CreateNNMatSpace_i:=CreateNNMatSpace_i+1
                         }
                         else 
                         {
                              skip 
                         };
                         if(continue=0)   then 
                         {
                             CreateNNMatSpace_i:=CreateNNMatSpace_i+1
                         }
                         else
                         {
                             skip
                         }
                     }
                     else
                     {
                         skip
                     }
                 }
                 else
                 {
                     skip
                 }
             }
             else
             {
                 skip
             }
         }
         else
         {
             skip
         }
         
     };
     continue<==0 and skip;
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function CreateNNSpaceAndLoadinPara2Layer ( CNN *cnn,Predefine pdf,int RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     cnn->Layers:=SpaceCreateLayers(cnn,RValue);
     MatCreate(&cnn->OnehotMat,1,pdf.LabelNum,RValue);
     LoadinPara2Layers(cnn,pdf,RValue);
     CreateNNMatSpace(cnn,RValue);
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function gaussrand_NORMAL ( float  RValue )
 {
     frame(gaussrand_NORMAL_V1,gaussrand_NORMAL_V2,gaussrand_NORMAL_S,gaussrand_NORMAL_phase,gaussrand_NORMAL_count,gaussrand_NORMAL_X,gaussrand_NORMAL_1_2_U1,gaussrand_NORMAL_1_2_U2,gaussrand_NORMAL_1_temp_S_1,gaussrand_NORMAL_3_temp_S_2,return) and ( 
     int return<==0 and skip;
     float gaussrand_NORMAL_V1<==0.0,gaussrand_NORMAL_V2<==0.0,gaussrand_NORMAL_S<==0.0 and skip;
     int gaussrand_NORMAL_phase<==0 and skip;
     int gaussrand_NORMAL_count<==0 and skip;
     float gaussrand_NORMAL_X and skip;
     if(gaussrand_NORMAL_phase=0) then 
     {
         while( (gaussrand_NORMAL_count=0 OR (gaussrand_NORMAL_S>=1 OR gaussrand_NORMAL_S=0)) )
         {
             float gaussrand_NORMAL_1_2_U1<==(float)(rand() % 10000)/ 10000.0 and skip;
             float gaussrand_NORMAL_1_2_U2<==(float)(rand() % 10000)/ 10000.0 and skip;
             gaussrand_NORMAL_V1:=2*gaussrand_NORMAL_1_2_U1-1;
             gaussrand_NORMAL_V2:=2*gaussrand_NORMAL_1_2_U2-1;
             gaussrand_NORMAL_S:=gaussrand_NORMAL_V1*gaussrand_NORMAL_V1+gaussrand_NORMAL_V2*gaussrand_NORMAL_V2;
             gaussrand_NORMAL_count:=gaussrand_NORMAL_count+1
         };
         float gaussrand_NORMAL_1_temp_S_1 and skip;
         gaussrand_NORMAL_1_temp_S_1:=(float)log(gaussrand_NORMAL_S);
         gaussrand_NORMAL_X:=gaussrand_NORMAL_V1*(float)sqrt(-2*gaussrand_NORMAL_1_temp_S_1/ gaussrand_NORMAL_S)
         
     }
     else
     {
         float gaussrand_NORMAL_3_temp_S_2 and skip;
         gaussrand_NORMAL_3_temp_S_2:=(float)log(gaussrand_NORMAL_S);
         gaussrand_NORMAL_X:=gaussrand_NORMAL_V2*(float)sqrt(-2*gaussrand_NORMAL_3_temp_S_2/ gaussrand_NORMAL_S)
     };
     gaussrand_NORMAL_phase:=1-gaussrand_NORMAL_phase;
     return<==1 and RValue:=gaussrand_NORMAL_X;
     skip
     )
     }; 
  function gaussrand ( float mean,float stdc,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     return<==1 and RValue:=mean+gaussrand_NORMAL(RValue)*stdc;
     skip
     )
     }; 
  function MatInitZero ( Mat *src,Mat* RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     MatZeros(src,RValue);
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function MatInitRandomNormalization ( Mat *src,Mat* RValue )
 {
     frame(MatInitRandomNormalization_temp$_1,MatInitRandomNormalization_row,MatInitRandomNormalization_col,return) and ( 
     int return<==0 and skip;
     int MatInitRandomNormalization_temp$_1 and skip;
     MatInitRandomNormalization_temp$_1:=time(NULL);
     srand((unsigned int)MatInitRandomNormalization_temp$_1) and skip;
     int MatInitRandomNormalization_row,MatInitRandomNormalization_col and skip;
     MatInitRandomNormalization_row:=0;
     
     while( (MatInitRandomNormalization_row<src->row) )
     {
         MatInitRandomNormalization_col:=0;
         
         while( (MatInitRandomNormalization_col<src->col) )
         {
             (src->element[MatInitRandomNormalization_row])[MatInitRandomNormalization_col]:=gaussrand(0.0,0.1,RValue);
             MatInitRandomNormalization_col:=MatInitRandomNormalization_col+1
             
         };
         MatInitRandomNormalization_row:=MatInitRandomNormalization_row+1
         
     };
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function MatInitXavier ( Mat *src,Mat* RValue )
 {
     frame(MatInitXavier_temp$_1,MatInitXavier_row,MatInitXavier_col,return) and ( 
     int return<==0 and skip;
     int MatInitXavier_temp$_1 and skip;
     MatInitXavier_temp$_1:=time(NULL);
     srand((unsigned int)MatInitXavier_temp$_1) and skip;
     int MatInitXavier_row,MatInitXavier_col and skip;
     MatInitXavier_row:=0;
     
     while( (MatInitXavier_row<src->row) )
     {
         MatInitXavier_col:=0;
         
         while( (MatInitXavier_col<src->col) )
         {
             (src->element[MatInitXavier_row])[MatInitXavier_col]:=gaussrand(0.0,0.1,RValue)*(float)sqrt(1.0/ src->row);
             MatInitXavier_col:=MatInitXavier_col+1
             
         };
         MatInitXavier_row:=MatInitXavier_row+1
         
     };
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function MatInitHe ( Mat *src,Mat* RValue )
 {
     frame(MatInitHe_row,MatInitHe_col,return) and ( 
     int return<==0 and skip;
     srand(19950826) and skip;
     int MatInitHe_row,MatInitHe_col and skip;
     MatInitHe_row:=0;
     
     while( (MatInitHe_row<src->row) )
     {
         MatInitHe_col:=0;
         
         while( (MatInitHe_col<src->col) )
         {
             (src->element[MatInitHe_row])[MatInitHe_col]:=gaussrand(0.0,0.9,RValue)*(float)sqrt(2.0/ src->row);
             MatInitHe_col:=MatInitHe_col+1
             
         };
         MatInitHe_row:=MatInitHe_row+1
         
     };
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function MatplusInitXavier ( Mat *src,int src_h,Mat* RValue )
 {
     frame(MatplusInitXavier_temp$_1,MatplusInitXavier_i,MatplusInitXavier_j,MatplusInitXavier_k,return) and ( 
     int return<==0 and skip;
     int MatplusInitXavier_temp$_1 and skip;
     MatplusInitXavier_temp$_1:=time(NULL);
     srand((unsigned int)MatplusInitXavier_temp$_1) and skip;
     int MatplusInitXavier_i,MatplusInitXavier_j,MatplusInitXavier_k and skip;
     MatplusInitXavier_i:=0;
     
     while( (MatplusInitXavier_i<src_h) )
     {
         MatplusInitXavier_j:=0;
         
         while( (MatplusInitXavier_j<src[0].row) )
         {
             MatplusInitXavier_k:=0;
             
             while( (MatplusInitXavier_k<src[0].col) )
             {
                 (src[MatplusInitXavier_i].element[MatplusInitXavier_j])[MatplusInitXavier_k]:=gaussrand(0.0,0.1,RValue)*(float)sqrt(1.0/ src_h*src[0].row*src[0].col);
                 MatplusInitXavier_k:=MatplusInitXavier_k+1
                 
             };
             MatplusInitXavier_j:=MatplusInitXavier_j+1
             
         };
         MatplusInitXavier_i:=MatplusInitXavier_i+1
         
     };
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function MatplusInitHe ( Mat *src,int src_h,Mat* RValue )
 {
     frame(MatplusInitHe_i,MatplusInitHe_j,MatplusInitHe_k,return) and ( 
     int return<==0 and skip;
     srand(19950826) and skip;
     int MatplusInitHe_i,MatplusInitHe_j,MatplusInitHe_k and skip;
     MatplusInitHe_i:=0;
     
     while( (MatplusInitHe_i<src_h) )
     {
         MatplusInitHe_j:=0;
         
         while( (MatplusInitHe_j<src[0].row) )
         {
             MatplusInitHe_k:=0;
             
             while( (MatplusInitHe_k<src[0].col) )
             {
                 (src[MatplusInitHe_i].element[MatplusInitHe_j])[MatplusInitHe_k]:=gaussrand(0.0,0.9,RValue)*(float)sqrt(2.0/ src_h*src[0].row*src[0].col);
                 MatplusInitHe_k:=MatplusInitHe_k+1
                 
             };
             MatplusInitHe_j:=MatplusInitHe_j+1
             
         };
         MatplusInitHe_i:=MatplusInitHe_i+1
         
     };
     return<==1 and RValue:=src;
     skip
     )
     }; 
  function WeightInit_ChooseWay ( Mat *Weight,int Style_initWeight )
 {
     if(Style_initWeight=0) then 
     {
         MatInitZero(Weight,RValue)
     }
     else
     {
         if(Style_initWeight=1) then 
         {
             MatInitRandomNormalization(Weight,RValue)
         }
         else
         {
             if(Style_initWeight=2) then 
             {
                 MatInitXavier(Weight,RValue)
             }
             else
             {
                 if(Style_initWeight=3) then 
                 {
                     MatInitHe(Weight,RValue)
                 }
                 else
                 {
                     output ("error for WeightInit_ChooseWay, please check Style_initWeight variable!\n") and skip
                 }
             }
         }
     }
     
 };
 function WeightInit_AverPool ( Mat *KernelMat,int *kers )
 {
     frame(WeightInit_AverPool_area,WeightInit_AverPool_row,WeightInit_AverPool_col) and ( 
     int WeightInit_AverPool_area<==kers[0]*kers[1] and skip;
     int WeightInit_AverPool_row,WeightInit_AverPool_col and skip;
     WeightInit_AverPool_row:=0;
     
     while( (WeightInit_AverPool_row<KernelMat->row) )
     {
         WeightInit_AverPool_col:=0;
         
         while( (WeightInit_AverPool_col<KernelMat->col) )
         {
             (KernelMat->element[WeightInit_AverPool_row])[WeightInit_AverPool_col]:=1.0/ (float)WeightInit_AverPool_area;
             WeightInit_AverPool_col:=WeightInit_AverPool_col+1
             
         };
         WeightInit_AverPool_row:=WeightInit_AverPool_row+1
         
     }
     )
     }; 
  function NNWeightInit ( CNN *cnn,int RValue )
 {
     frame(NNWeightInit_i,return) and ( 
     int return<==0 and skip;
     int NNWeightInit_i and skip;
     NNWeightInit_i:=1;
     
     while( (NNWeightInit_i<cnn->HiddenLayerNum+2) )
     {
         if(cnn->Layers[NNWeightInit_i].LayerType=0 OR cnn->Layers[NNWeightInit_i].LayerType=1) then 
         {
             WeightInit_ChooseWay(&cnn->Layers[NNWeightInit_i].KernelMat,cnn->WeightInitWayNum);
             MatPlusRow(&cnn->Layers[NNWeightInit_i].KernelMat,&cnn->Layers[NNWeightInit_i].WeightMat)
             
         }
         else
         {
             if(cnn->Layers[NNWeightInit_i].LayerType=4) then 
             {
                 WeightInit_AverPool(&cnn->Layers[NNWeightInit_i].KernelMat,cnn->Layers[NNWeightInit_i].KernelSize)
             }
             else
             {
                 WeightInit_ChooseWay(&cnn->Layers[NNWeightInit_i].KernelMat,cnn->WeightInitWayNum)
             }
         };
         NNWeightInit_i:=NNWeightInit_i+1
         
     };
     return<==1 and RValue:=0;
     skip
     )
     }; 
  function sigmoid ( float z,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     return<==1 and RValue:=(float)(1/ (1+exp(-z)));
     skip
     )
     }; 
  function relu ( float z,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     return<==1 and RValue:=( if(z>0) then z else 0);
     skip
     )
     }; 
  function leakyRelu ( float z,float a,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     return<==1 and RValue:=( if(z<0) then a else z);
     skip
     )
     }; 
  function MatSoftmax ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatSoftmax_tempV,return) and ( 
     int return<==0 and skip;
     Mat MatSoftmax_tempV and skip;
     MatCreate(&MatSoftmax_tempV,src->row,1,RValue);
     MatRowMax(src,&MatSoftmax_tempV,RValue);
     MatVectorSub(src,&MatSoftmax_tempV,dst,RValue);
     MatExp(dst,dst,RValue);
     MatRowSum(dst,&MatSoftmax_tempV,RValue);
     MatVectorDiv(dst,&MatSoftmax_tempV,dst,RValue);
     MatDelete(&MatSoftmax_tempV);
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatNoneActi ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatNoneActi_row,MatNoneActi_col,return) and ( 
     int return<==0 and skip;
     int MatNoneActi_row,MatNoneActi_col and skip;
     MatNoneActi_row:=0;
     
     while( (MatNoneActi_row<src->row) )
     {
         MatNoneActi_col:=0;
         
         while( (MatNoneActi_col<src->col) )
         {
             (dst->element[MatNoneActi_row])[MatNoneActi_col]:=(src->element[MatNoneActi_row])[MatNoneActi_col];
             MatNoneActi_col:=MatNoneActi_col+1
             
         };
         MatNoneActi_row:=MatNoneActi_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatSigmoid ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatSigmoid_row,MatSigmoid_col,return) and ( 
     int return<==0 and skip;
     int MatSigmoid_row,MatSigmoid_col and skip;
     MatSigmoid_row:=0;
     
     while( (MatSigmoid_row<src->row) )
     {
         MatSigmoid_col:=0;
         
         while( (MatSigmoid_col<src->col) )
         {
             (dst->element[MatSigmoid_row])[MatSigmoid_col]:=sigmoid((src->element[MatSigmoid_row])[MatSigmoid_col],RValue);
             MatSigmoid_col:=MatSigmoid_col+1
             
         };
         MatSigmoid_row:=MatSigmoid_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatTanh ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatTanh_row,MatTanh_col,return) and ( 
     int return<==0 and skip;
     int MatTanh_row,MatTanh_col and skip;
     MatTanh_row:=0;
     
     while( (MatTanh_row<src->row) )
     {
         MatTanh_col:=0;
         
         while( (MatTanh_col<src->col) )
         {
             (dst->element[MatTanh_row])[MatTanh_col]:=(float)tanh((src->element[MatTanh_row])[MatTanh_col]);
             MatTanh_col:=MatTanh_col+1
             
         };
         MatTanh_row:=MatTanh_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatRelu ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatRelu_row,MatRelu_col,return) and ( 
     int return<==0 and skip;
     int MatRelu_row,MatRelu_col and skip;
     MatRelu_row:=0;
     
     while( (MatRelu_row<src->row) )
     {
         MatRelu_col:=0;
         
         while( (MatRelu_col<src->col) )
         {
             (dst->element[MatRelu_row])[MatRelu_col]:=relu((src->element[MatRelu_row])[MatRelu_col],RValue);
             MatRelu_col:=MatRelu_col+1
             
         };
         MatRelu_row:=MatRelu_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatLeakyRelu ( float a,Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatLeakyRelu_row,MatLeakyRelu_col,return) and ( 
     int return<==0 and skip;
     int MatLeakyRelu_row,MatLeakyRelu_col and skip;
     MatLeakyRelu_row:=0;
     
     while( (MatLeakyRelu_row<src->row) )
     {
         MatLeakyRelu_col:=0;
         
         while( (MatLeakyRelu_col<src->col) )
         {
             (dst->element[MatLeakyRelu_row])[MatLeakyRelu_col]:=leakyRelu((src->element[MatLeakyRelu_row])[MatLeakyRelu_col],a,RValue);
             MatLeakyRelu_col:=MatLeakyRelu_col+1
             
         };
         MatLeakyRelu_row:=MatLeakyRelu_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationSoftmax ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationSoftmax_row,MatDerivationSoftmax_col,MatDerivationSoftmax_i,return) and ( 
     int return<==0 and skip;
     int MatDerivationSoftmax_row,MatDerivationSoftmax_col,MatDerivationSoftmax_i and skip;
     MatSoftmax(src,src,RValue);
     MatZeros(dst,RValue);
     MatDerivationSoftmax_row:=0;
     
     while( (MatDerivationSoftmax_row<src->row) )
     {
         MatDerivationSoftmax_col:=0;
         
         while( (MatDerivationSoftmax_col<src->col) )
         {
             MatDerivationSoftmax_i:=0;
             
             while( (MatDerivationSoftmax_i<src->col) )
             {
                 if(MatDerivationSoftmax_i=MatDerivationSoftmax_col) then 
                 {
                     (dst->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col]:=(dst->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col]+(src->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_i]*(1-(src->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col])
                     
                 }
                 else
                 {
                     (dst->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col]:=(dst->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col]+-(src->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_i]*(src->element[MatDerivationSoftmax_row])[MatDerivationSoftmax_col]
                 };
                 MatDerivationSoftmax_i:=MatDerivationSoftmax_i+1
                 
             };
             MatDerivationSoftmax_col:=MatDerivationSoftmax_col+1
             
         };
         MatDerivationSoftmax_row:=MatDerivationSoftmax_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationNoneActi ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationNoneActi_row,MatDerivationNoneActi_col,return) and ( 
     int return<==0 and skip;
     int MatDerivationNoneActi_row,MatDerivationNoneActi_col and skip;
     MatDerivationNoneActi_row:=0;
     
     while( (MatDerivationNoneActi_row<src->row) )
     {
         MatDerivationNoneActi_col:=0;
         
         while( (MatDerivationNoneActi_col<src->col) )
         {
             (dst->element[MatDerivationNoneActi_row])[MatDerivationNoneActi_col]:=1.0;
             MatDerivationNoneActi_col:=MatDerivationNoneActi_col+1
             
         };
         MatDerivationNoneActi_row:=MatDerivationNoneActi_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationSigmoid ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationSigmoid_temp1Mat,MatDerivationSigmoid_temp2Mat,return) and ( 
     int return<==0 and skip;
     Mat MatDerivationSigmoid_temp1Mat and skip;
     Mat MatDerivationSigmoid_temp2Mat and skip;
     MatCreate(&MatDerivationSigmoid_temp1Mat,src->row,src->col,RValue);
     MatCreate(&MatDerivationSigmoid_temp2Mat,src->row,src->col,RValue);
     MatSigmoid(src,&MatDerivationSigmoid_temp1Mat,RValue);
     MatNumMul(-1.0,&MatDerivationSigmoid_temp1Mat,&MatDerivationSigmoid_temp2Mat,RValue);
     MatNumAdd(1.0,&MatDerivationSigmoid_temp2Mat,&MatDerivationSigmoid_temp2Mat,RValue);
     MatProduct(&MatDerivationSigmoid_temp1Mat,&MatDerivationSigmoid_temp2Mat,dst,RValue);
     MatDelete(&MatDerivationSigmoid_temp1Mat);
     MatDelete(&MatDerivationSigmoid_temp2Mat);
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationTanh ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationTanh_tempMat,return) and ( 
     int return<==0 and skip;
     Mat MatDerivationTanh_tempMat and skip;
     MatCreate(&MatDerivationTanh_tempMat,src->row,src->col,RValue);
     MatTanh(src,&MatDerivationTanh_tempMat,RValue);
     MatSquare(&MatDerivationTanh_tempMat,&MatDerivationTanh_tempMat,RValue);
     MatNumMul(-1.0,&MatDerivationTanh_tempMat,&MatDerivationTanh_tempMat,RValue);
     MatNumAdd(1.0,&MatDerivationTanh_tempMat,dst,RValue);
     MatDelete(&MatDerivationTanh_tempMat);
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationRelu ( Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationRelu_row,MatDerivationRelu_col,return) and ( 
     int return<==0 and skip;
     int MatDerivationRelu_row,MatDerivationRelu_col and skip;
     MatDerivationRelu_row:=0;
     
     while( (MatDerivationRelu_row<src->row) )
     {
         MatDerivationRelu_col:=0;
         
         while( (MatDerivationRelu_col<src->col) )
         {
             if((src->element[MatDerivationRelu_row])[MatDerivationRelu_col]>0) then 
             {
                 (dst->element[MatDerivationRelu_row])[MatDerivationRelu_col]:=1.0
                 
             }
             else
             {
                 (dst->element[MatDerivationRelu_row])[MatDerivationRelu_col]:=0.0
             };
             MatDerivationRelu_col:=MatDerivationRelu_col+1
             
         };
         MatDerivationRelu_row:=MatDerivationRelu_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatDerivationLeakyRelu ( float a,Mat *src,Mat *dst,Mat* RValue )
 {
     frame(MatDerivationLeakyRelu_row,MatDerivationLeakyRelu_col,return) and ( 
     int return<==0 and skip;
     int MatDerivationLeakyRelu_row,MatDerivationLeakyRelu_col and skip;
     MatDerivationLeakyRelu_row:=0;
     
     while( (MatDerivationLeakyRelu_row<src->row) )
     {
         MatDerivationLeakyRelu_col:=0;
         
         while( (MatDerivationLeakyRelu_col<src->col) )
         {
             if((src->element[MatDerivationLeakyRelu_row])[MatDerivationLeakyRelu_col]>0) then 
             {
                 (dst->element[MatDerivationLeakyRelu_row])[MatDerivationLeakyRelu_col]:=1.0
                 
             }
             else
             {
                 (dst->element[MatDerivationLeakyRelu_row])[MatDerivationLeakyRelu_col]:=a
             };
             MatDerivationLeakyRelu_col:=MatDerivationLeakyRelu_col+1
             
         };
         MatDerivationLeakyRelu_row:=MatDerivationLeakyRelu_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function OneHot ( Mat *src,int k,Mat *dst,Mat* RValue )
 {
     frame(OneHot_row,return) and ( 
     int return<==0 and skip;
     int OneHot_row and skip;
     MatZeros(dst,RValue);
     OneHot_row:=0;
     
     while( (OneHot_row<dst->row) )
     {
         (dst->element[OneHot_row])[(int)((src->element[OneHot_row])[0])]:=1.0;
         OneHot_row:=OneHot_row+1
         
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MSE ( Mat *src,Mat *dst,float RValue )
 {
     frame(MSE_row,MSE_loss,MSE_sub_square_mat,MSE_sum_row_mat,return) and ( 
     int return<==0 and skip;
     int MSE_row and skip;
     float MSE_loss<==0.0 and skip;
     Mat MSE_sub_square_mat and skip;
     Mat MSE_sum_row_mat and skip;
     MatCreate(&MSE_sub_square_mat,src->row,src->col,RValue);
     MatCreate(&MSE_sum_row_mat,src->row,1,RValue);
     MatSub(src,dst,&MSE_sub_square_mat,RValue);
     MatSquare(&MSE_sub_square_mat,&MSE_sub_square_mat,RValue);
     MatRowSum(&MSE_sub_square_mat,&MSE_sum_row_mat,RValue);
     MSE_row:=0;
     
     while( (MSE_row<src->row) )
     {
         MSE_loss:=MSE_loss+(MSE_sum_row_mat.element[MSE_row])[0];
         MSE_row:=MSE_row+1
         
     };
     MSE_loss:=MSE_loss/ (float)(src->row);
     MatDelete(&MSE_sub_square_mat);
     MatDelete(&MSE_sum_row_mat);
     return<==1 and RValue:=MSE_loss;
     skip
     )
     }; 
  function CrossEntropy ( Mat *src,Mat *dst,float RValue )
 {
     frame(CrossEntropy_row,CrossEntropy_col,CrossEntropy_loss,return) and ( 
     int return<==0 and skip;
     int CrossEntropy_row,CrossEntropy_col and skip;
     float CrossEntropy_loss<==0.0 and skip;
     CrossEntropy_row:=0;
     
     while( (CrossEntropy_row<src->row) )
     {
         CrossEntropy_col:=0;
         
         while( (CrossEntropy_col<src->col) )
         {
             CrossEntropy_loss:=CrossEntropy_loss+(float)(-1*(dst->element[CrossEntropy_row])[CrossEntropy_col]*log((src->element[CrossEntropy_row])[CrossEntropy_col]));
             CrossEntropy_col:=CrossEntropy_col+1
             
         };
         CrossEntropy_row:=CrossEntropy_row+1
         
     };
     CrossEntropy_loss:=CrossEntropy_loss/ (src->row);
     return<==1 and RValue:=CrossEntropy_loss;
     skip
     )
     }; 
  function MSEDerivative ( Mat *ActiMat,Mat *DerivativeActiMat,Mat One_hotMat,Mat* RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     return<==1 and RValue:=MatSub(ActiMat,&One_hotMat,DerivativeActiMat,RValue);
     skip
     )
     }; 
  function CrossEntropyDerivative ( Mat *ActiMat,Mat *DerivativeActiMat,Mat One_hotMat,Mat* RValue )
 {
     frame(CrossEntropyDerivative_row,CrossEntropyDerivative_col,CrossEntropyDerivative_1_2_temp$_1,return) and ( 
     int return<==0 and skip;
     int CrossEntropyDerivative_row,CrossEntropyDerivative_col and skip;
     CrossEntropyDerivative_row:=0;
     
     while( (CrossEntropyDerivative_row<ActiMat->row) )
     {
         CrossEntropyDerivative_col:=0;
         
         while( (CrossEntropyDerivative_col<ActiMat->col) )
         {
             int CrossEntropyDerivative_1_2_temp$_1 and skip;
             CrossEntropyDerivative_1_2_temp$_1:=equal((ActiMat->element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col],0.0,RValue);
             if(CrossEntropyDerivative_1_2_temp$_1=1) then 
             {
                 (DerivativeActiMat->element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col]:=-(One_hotMat.element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col]*10000000000
                 
             }
             else
             {
                 (DerivativeActiMat->element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col]:=-(One_hotMat.element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col]/ (ActiMat->element[CrossEntropyDerivative_row])[CrossEntropyDerivative_col]
             };
             CrossEntropyDerivative_col:=CrossEntropyDerivative_col+1
             
         };
         CrossEntropyDerivative_row:=CrossEntropyDerivative_row+1
         
     };
     return<==1 and RValue:=DerivativeActiMat;
     skip
     )
     }; 
  function MatPadReConstructBias ( Mat *des,int des_h,Mat *src,int src_h,int *kers,int *strd,int pad,Mat* RValue )
 {
     frame(MatPadReConstructBias_pdh,MatPadReConstructBias_pdw,MatPadReConstructBias_i,MatPadReConstructBias_j,MatPadReConstructBias_k,MatPadReConstructBias_m,MatPadReConstructBias_n,return) and ( 
     int return<==0 and skip;
     int MatPadReConstructBias_pdh,MatPadReConstructBias_pdw and skip;
     if(pad=0) then 
     {
         MatPadReConstructBias_pdh:=0;
         MatPadReConstructBias_pdw:=0
         
     }
     else
     {
         if(pad=1) then 
         {
             if(strd[0]=1) then 
             {
                 MatPadReConstructBias_pdh:=kers[0]-1
             }
             else
             {
                 MatPadReConstructBias_pdh:=kers[0]-src_h % strd[0]
             };
             if(strd[1]=1) then 
             {
                 MatPadReConstructBias_pdw:=kers[1]-1
             }
             else
             {
                 MatPadReConstructBias_pdw:=kers[1]-src[0].row % strd[1]
             }
         }
         else
         {
             return<==1 and RValue:=NULL;
             skip
         }
     };
     if(return=0)  then
     {
         if((!pad AND ((des_h!=(src_h+strd[0]-kers[0])/ strd[0]) OR (des[0].row!=(src[0].row+strd[1]-kers[1])/ strd[1]))) OR (pad AND ((des_h!=(src_h+strd[0]-1)/ strd[0]) OR (des[0].row!=(src[0].row+strd[1]-1)/ strd[1]))) OR des[0].col!=kers[0]*kers[1]*src[0].col+1) then 
         {
             output ("\t\terr check, unmathed matrix for MatPadReConstruct\t\t\n") and skip;
             output ("\t\tDesMatShape:\n\t\t\t") and skip;
             MatplusShape(des,des_h);
             output ("\t\tSrcMatShape:\n\t\t\t") and skip;
             MatplusShape(src,src_h);
             return<==1 and RValue:=NULL;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             int MatPadReConstructBias_i,MatPadReConstructBias_j,MatPadReConstructBias_k,MatPadReConstructBias_m,MatPadReConstructBias_n and skip;
             MatPadReConstructBias_i:=0;
             
             while( (MatPadReConstructBias_i<des_h) )
             {
                 MatPadReConstructBias_j:=0;
                 
                 while( (MatPadReConstructBias_j<des[0].row) )
                 {
                     (des[MatPadReConstructBias_i].element[MatPadReConstructBias_j])[0]:=1.0;
                     MatPadReConstructBias_k:=0;
                     
                     while( (MatPadReConstructBias_k<src[MatPadReConstructBias_i].col) )
                     {
                         MatPadReConstructBias_m:=0;
                         
                         while( (MatPadReConstructBias_m<kers[0]) )
                         {
                             MatPadReConstructBias_n:=0;
                             
                             while( (MatPadReConstructBias_n<kers[1]) )
                             {
                                 if(MatPadReConstructBias_i*strd[0]+MatPadReConstructBias_m<MatPadReConstructBias_pdh/ 2 OR MatPadReConstructBias_j*strd[1]+MatPadReConstructBias_n<MatPadReConstructBias_pdw/ 2 OR MatPadReConstructBias_i*strd[0]+MatPadReConstructBias_m>=src_h+MatPadReConstructBias_pdh/ 2 OR MatPadReConstructBias_j*strd[1]+MatPadReConstructBias_n>=src[0].row+MatPadReConstructBias_pdw/ 2) then 
                                 {
                                     (des[MatPadReConstructBias_i].element[MatPadReConstructBias_j])[MatPadReConstructBias_k*kers[0]*kers[1]+MatPadReConstructBias_m*kers[1]+MatPadReConstructBias_n+1]:=0
                                     
                                 }
                                 else
                                 {
                                     (des[MatPadReConstructBias_i].element[MatPadReConstructBias_j])[MatPadReConstructBias_k*kers[0]*kers[1]+MatPadReConstructBias_m*kers[1]+MatPadReConstructBias_n+1]:=(src[MatPadReConstructBias_i*strd[0]+MatPadReConstructBias_m-MatPadReConstructBias_pdh/ 2].element[MatPadReConstructBias_j*strd[1]+MatPadReConstructBias_n-MatPadReConstructBias_pdw/ 2])[MatPadReConstructBias_k]
                                 };
                                 MatPadReConstructBias_n:=MatPadReConstructBias_n+1
                                 
                             };
                             MatPadReConstructBias_m:=MatPadReConstructBias_m+1
                             
                         };
                         MatPadReConstructBias_k:=MatPadReConstructBias_k+1
                         
                     };
                     MatPadReConstructBias_j:=MatPadReConstructBias_j+1
                     
                 };
                 MatPadReConstructBias_i:=MatPadReConstructBias_i+1
                 
             };
             return<==1 and RValue:=des;
             skip
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function MatPadReConstruct ( Mat *des,int des_h,Mat *src,int src_h,int *kers,int *strd,int pad,Mat* RValue )
 {
     frame(MatPadReConstruct_pdh,MatPadReConstruct_pdw,MatPadReConstruct_i,MatPadReConstruct_j,MatPadReConstruct_k,MatPadReConstruct_m,MatPadReConstruct_n,return) and ( 
     int return<==0 and skip;
     int MatPadReConstruct_pdh,MatPadReConstruct_pdw and skip;
     if(pad=0) then 
     {
         MatPadReConstruct_pdh:=0;
         MatPadReConstruct_pdw:=0
         
     }
     else
     {
         if(pad=1) then 
         {
             if(strd[0]=1) then 
             {
                 MatPadReConstruct_pdh:=kers[0]-1
             }
             else
             {
                 MatPadReConstruct_pdh:=kers[0]-src_h % strd[0]
             };
             if(strd[1]=1) then 
             {
                 MatPadReConstruct_pdw:=kers[1]-1
             }
             else
             {
                 MatPadReConstruct_pdw:=kers[1]-src[0].row % strd[1]
             }
         }
         else
         {
             return<==1 and RValue:=NULL;
             skip
         }
     };
     if(return=0)  then
     {
         if((!pad AND ((des_h!=(src_h+strd[0]-kers[0])/ strd[0]) OR (des[0].row!=(src[0].row+strd[1]-kers[1])/ strd[1]))) OR (pad AND ((des_h!=(src_h+strd[0]-1)/ strd[0]) OR (des[0].row!=(src[0].row+strd[1]-1)/ strd[1]))) OR des[0].col!=kers[0]*kers[1]*src[0].col) then 
         {
             output ("\t\terr check, unmathed matrix for MatPadReConstruct\t\t\n") and skip;
             output ("\t\tDesMatShape:\n\t\t\t") and skip;
             MatplusShape(des,des_h);
             output ("\t\tSrcMatShape:\n\t\t\t") and skip;
             MatplusShape(src,src_h);
             return<==1 and RValue:=NULL;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             int MatPadReConstruct_i,MatPadReConstruct_j,MatPadReConstruct_k,MatPadReConstruct_m,MatPadReConstruct_n and skip;
             MatPadReConstruct_i:=0;
             
             while( (MatPadReConstruct_i<des_h) )
             {
                 MatPadReConstruct_j:=0;
                 
                 while( (MatPadReConstruct_j<des[0].row) )
                 {
                     MatPadReConstruct_k:=0;
                     
                     while( (MatPadReConstruct_k<src[MatPadReConstruct_i].col) )
                     {
                         MatPadReConstruct_m:=0;
                         
                         while( (MatPadReConstruct_m<kers[0]) )
                         {
                             MatPadReConstruct_n:=0;
                             
                             while( (MatPadReConstruct_n<kers[1]) )
                             {
                                 if(MatPadReConstruct_i*strd[0]+MatPadReConstruct_m<MatPadReConstruct_pdh/ 2 OR MatPadReConstruct_j*strd[1]+MatPadReConstruct_n<MatPadReConstruct_pdw/ 2 OR MatPadReConstruct_i*strd[0]+MatPadReConstruct_m>=src_h+MatPadReConstruct_pdh/ 2 OR MatPadReConstruct_j*strd[1]+MatPadReConstruct_n>=src[0].row+MatPadReConstruct_pdw/ 2) then 
                                 {
                                     (des[MatPadReConstruct_i].element[MatPadReConstruct_j])[MatPadReConstruct_k*kers[0]*kers[1]+MatPadReConstruct_m*kers[1]+MatPadReConstruct_n]:=0
                                     
                                 }
                                 else
                                 {
                                     (des[MatPadReConstruct_i].element[MatPadReConstruct_j])[MatPadReConstruct_k*kers[0]*kers[1]+MatPadReConstruct_m*kers[1]+MatPadReConstruct_n]:=(src[MatPadReConstruct_i*strd[0]+MatPadReConstruct_m-MatPadReConstruct_pdh/ 2].element[MatPadReConstruct_j*strd[1]+MatPadReConstruct_n-MatPadReConstruct_pdw/ 2])[MatPadReConstruct_k]
                                 };
                                 MatPadReConstruct_n:=MatPadReConstruct_n+1
                                 
                             };
                             MatPadReConstruct_m:=MatPadReConstruct_m+1
                             
                         };
                         MatPadReConstruct_k:=MatPadReConstruct_k+1
                         
                     };
                     MatPadReConstruct_j:=MatPadReConstruct_j+1
                     
                 };
                 MatPadReConstruct_i:=MatPadReConstruct_i+1
                 
             };
             return<==1 and RValue:=des;
             skip
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function MatplusMulMat ( Mat *sm,int sm_h,Mat *om,int om_h,Mat wm,Mat* RValue )
 {
     frame(MatplusMulMat_i,MatplusMulMat_j,MatplusMulMat_k,MatplusMulMat_l,MatplusMulMat_tmp,return) and ( 
     int return<==0 and skip;
     if(om_h!=sm_h OR om[0].row!=sm[0].row OR wm.row!=om[0].col OR wm.col!=sm[0].col) then 
     {
         output ("\t\terr check, unmathed matrix for MatplusMulMat\t\t\n") and skip;
         output ("\t\tOriginMatShape:\n\t\t\t") and skip;
         MatplusShape(om,sm_h);
         output ("\t\tWeightMatShape:\n\t\t\t") and skip;
         MatShape(&wm);
         output ("\t\tSumMatShape:\n\t\t\t") and skip;
         MatplusShape(sm,sm_h);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int MatplusMulMat_i,MatplusMulMat_j,MatplusMulMat_k,MatplusMulMat_l and skip;
         MatplusZeros(sm,sm_h,RValue);
         MatplusMulMat_i:=0;
         
         while( (MatplusMulMat_i<sm_h) )
         {
             MatplusMulMat_j:=0;
             
             while( (MatplusMulMat_j<sm[0].row) )
             {
                 MatplusMulMat_k:=0;
                 
                 while( (MatplusMulMat_k<sm[0].col) )
                 {
                     float MatplusMulMat_tmp<==0.0 and skip;
                     MatplusMulMat_l:=0;
                     
                     while( (MatplusMulMat_l<om[0].col) )
                     {
                         MatplusMulMat_tmp:=MatplusMulMat_tmp+(om[MatplusMulMat_i].element[MatplusMulMat_j])[MatplusMulMat_l]*(wm.element[MatplusMulMat_l])[MatplusMulMat_k];
                         MatplusMulMat_l:=MatplusMulMat_l+1
                         
                     };
                     (sm[MatplusMulMat_i].element[MatplusMulMat_j])[MatplusMulMat_k]:=MatplusMulMat_tmp;
                     MatplusMulMat_k:=MatplusMulMat_k+1
                     
                 };
                 MatplusMulMat_j:=MatplusMulMat_j+1
                 
             };
             MatplusMulMat_i:=MatplusMulMat_i+1
             
         };
         return<==1 and RValue:=sm;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MatplusMulMat_T_unmatch ( Mat *dst,int dst_h,Mat *src,int src_h,Mat km,Mat* RValue )
 {
     frame(MatplusMulMat_T_unmatch_cnt1,MatplusMulMat_T_unmatch_cnt2,MatplusMulMat_T_unmatch_cnt3,MatplusMulMat_T_unmatch_i,MatplusMulMat_T_unmatch_j,MatplusMulMat_T_unmatch_k,MatplusMulMat_T_unmatch_l,MatplusMulMat_T_unmatch_tmp,return) and ( 
     int return<==0 and skip;
     if(src_h*src[0].row*km.row!=dst_h*dst[0].row*dst[0].col OR src[0].col!=km.col) then 
     {
         output ("\t\terr check, unmathed matrix for MatplusMulMat_T_unmatch\t\t\n") and skip;
         output ("\t\tDstShape:\n\t\t\t") and skip;
         MatplusShape(dst,dst_h);
         output ("\t\tKernelMatShape:\n\t\t\t") and skip;
         MatShape(&km);
         output ("\t\tSrcShape:\n\t\t\t") and skip;
         MatplusShape(src,src_h);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int MatplusMulMat_T_unmatch_cnt1<==0,MatplusMulMat_T_unmatch_cnt2<==0,MatplusMulMat_T_unmatch_cnt3<==0 and skip;
         int MatplusMulMat_T_unmatch_i,MatplusMulMat_T_unmatch_j,MatplusMulMat_T_unmatch_k,MatplusMulMat_T_unmatch_l and skip;
         MatplusMulMat_T_unmatch_i:=0;
         
         while( (MatplusMulMat_T_unmatch_i<src_h) )
         {
             MatplusMulMat_T_unmatch_j:=0;
             
             while( (MatplusMulMat_T_unmatch_j<src[0].row) )
             {
                 MatplusMulMat_T_unmatch_k:=0;
                 
                 while( (MatplusMulMat_T_unmatch_k<km.row) )
                 {
                     float MatplusMulMat_T_unmatch_tmp<==0.0 and skip;
                     MatplusMulMat_T_unmatch_l:=0;
                     
                     while( (MatplusMulMat_T_unmatch_l<km.col) )
                     {
                         MatplusMulMat_T_unmatch_tmp:=MatplusMulMat_T_unmatch_tmp+(src[MatplusMulMat_T_unmatch_i].element[MatplusMulMat_T_unmatch_j])[MatplusMulMat_T_unmatch_l]*(km.element[MatplusMulMat_T_unmatch_k])[MatplusMulMat_T_unmatch_l];
                         MatplusMulMat_T_unmatch_l:=MatplusMulMat_T_unmatch_l+1
                         
                     };
                     (dst[MatplusMulMat_T_unmatch_cnt1].element[MatplusMulMat_T_unmatch_cnt2])[MatplusMulMat_T_unmatch_cnt3]:=MatplusMulMat_T_unmatch_tmp;
                     MatplusMulMat_T_unmatch_cnt3:=MatplusMulMat_T_unmatch_cnt3+1;
                     if(MatplusMulMat_T_unmatch_cnt3>=dst[0].col) then 
                     {
                         MatplusMulMat_T_unmatch_cnt2:=MatplusMulMat_T_unmatch_cnt2+1;
                         MatplusMulMat_T_unmatch_cnt3:=0;
                         if(MatplusMulMat_T_unmatch_cnt2>=dst[0].row) then 
                         {
                             MatplusMulMat_T_unmatch_cnt1:=MatplusMulMat_T_unmatch_cnt1+1;
                             MatplusMulMat_T_unmatch_cnt2:=0
                             
                         }
                         else 
                         {
                              skip 
                         }
                         
                     }
                     else 
                     {
                          skip 
                     };
                     MatplusMulMat_T_unmatch_k:=MatplusMulMat_T_unmatch_k+1
                     
                 };
                 MatplusMulMat_T_unmatch_j:=MatplusMulMat_T_unmatch_j+1
                 
             };
             MatplusMulMat_T_unmatch_i:=MatplusMulMat_T_unmatch_i+1
             
         };
         return<==1 and RValue:=dst;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MatplusMulMat_T ( Mat *dst,int dst_h,Mat *src,int src_h,Mat km,Mat* RValue )
 {
     frame(MatplusMulMat_T_i,MatplusMulMat_T_j,MatplusMulMat_T_k,MatplusMulMat_T_l,MatplusMulMat_T_tmp,return) and ( 
     int return<==0 and skip;
     if(src_h!=dst_h OR src[0].row!=dst[0].row OR km.row!=dst[0].col OR src[0].col!=km.col) then 
     {
         output ("\t\terr check, unmathed matrix for MatplusMulMat_T\t\t\n") and skip;
         output ("\t\tDstShape:\n\t\t\t") and skip;
         MatplusShape(dst,dst_h);
         output ("\t\tKernelMatShape:\n\t\t\t") and skip;
         MatShape(&km);
         output ("\t\tSrcShape:\n\t\t\t") and skip;
         MatplusShape(src,src_h);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int MatplusMulMat_T_i,MatplusMulMat_T_j,MatplusMulMat_T_k,MatplusMulMat_T_l and skip;
         MatplusMulMat_T_i:=0;
         
         while( (MatplusMulMat_T_i<dst_h) )
         {
             MatplusMulMat_T_j:=0;
             
             while( (MatplusMulMat_T_j<dst[0].row) )
             {
                 MatplusMulMat_T_k:=0;
                 
                 while( (MatplusMulMat_T_k<dst[0].col) )
                 {
                     float MatplusMulMat_T_tmp<==0.0 and skip;
                     MatplusMulMat_T_l:=0;
                     
                     while( (MatplusMulMat_T_l<src[0].col) )
                     {
                         MatplusMulMat_T_tmp:=MatplusMulMat_T_tmp+(src[MatplusMulMat_T_i].element[MatplusMulMat_T_j])[MatplusMulMat_T_l]*(km.element[MatplusMulMat_T_k])[MatplusMulMat_T_l];
                         MatplusMulMat_T_l:=MatplusMulMat_T_l+1
                         
                     };
                     (dst[MatplusMulMat_T_i].element[MatplusMulMat_T_j])[MatplusMulMat_T_k]:=MatplusMulMat_T_tmp;
                     MatplusMulMat_T_k:=MatplusMulMat_T_k+1
                     
                 };
                 MatplusMulMat_T_j:=MatplusMulMat_T_j+1
                 
             };
             MatplusMulMat_T_i:=MatplusMulMat_T_i+1
             
         };
         return<==1 and RValue:=dst;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MatDeConstruct ( Mat *des,int des_h,Mat *src,int src_h,int *kers,int *strd,int pad,Mat* RValue )
 {
     frame(MatDeConstruct_i,MatDeConstruct_j,MatDeConstruct_k,MatDeConstruct_d1,MatDeConstruct_d2,MatDeConstruct_d3,return) and ( 
     int return<==0 and skip;
     if(des_h!=(src_h-1)*strd[0]+kers[0] OR des[0].row!=(src[0].row-1)*strd[1]+kers[1] OR kers[0]*kers[1]*des[0].col!=src[0].col) then 
     {
         output ("\t\terr check, unmathed matrix for MatDeConstruct\t\t\n") and skip;
         output ("\t\tDstShape:\n\t\t\t") and skip;
         MatplusShape(des,des_h);
         output ("\t\tSrcShape:\n\t\t\t") and skip;
         MatplusShape(src,src_h);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         MatplusZeros(des,des_h,RValue);
         int MatDeConstruct_i,MatDeConstruct_j,MatDeConstruct_k and skip;
         MatDeConstruct_i:=0;
         
         while( (MatDeConstruct_i<src_h) )
         {
             MatDeConstruct_j:=0;
             
             while( (MatDeConstruct_j<src[0].row) )
             {
                 MatDeConstruct_k:=0;
                 
                 while( (MatDeConstruct_k<src[MatDeConstruct_i].col) )
                 {
                     int MatDeConstruct_d1,MatDeConstruct_d2,MatDeConstruct_d3 and skip;
                     MatDeConstruct_d1:=MatDeConstruct_i*strd[0]+(MatDeConstruct_k/ kers[1]) % kers[0];
                     MatDeConstruct_d2:=MatDeConstruct_j*strd[1]+MatDeConstruct_k % kers[1];
                     MatDeConstruct_d3:=MatDeConstruct_k/ (kers[0]*kers[1]);
                     (des[MatDeConstruct_d1].element[MatDeConstruct_d2])[MatDeConstruct_d3]:=(des[MatDeConstruct_d1].element[MatDeConstruct_d2])[MatDeConstruct_d3]+(src[MatDeConstruct_i].element[MatDeConstruct_j])[MatDeConstruct_k];
                     MatDeConstruct_k:=MatDeConstruct_k+1
                     
                 };
                 MatDeConstruct_j:=MatDeConstruct_j+1
                 
             };
             MatDeConstruct_i:=MatDeConstruct_i+1
             
         };
         return<==1 and RValue:=des;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MatDeConstructfwd ( Mat *des,int des_h,Mat *src,int src_h,int *kers,int *strd,int pad,Mat* RValue )
 {
     frame(MatDeConstructfwd_pdh,MatDeConstructfwd_pdw,MatDeConstructfwd_i,MatDeConstructfwd_j,MatDeConstructfwd_k,MatDeConstructfwd_d1,MatDeConstructfwd_d2,MatDeConstructfwd_d3,return) and ( 
     int return<==0 and skip;
     int MatDeConstructfwd_pdh,MatDeConstructfwd_pdw and skip;
     if(pad=0) then 
     {
         MatDeConstructfwd_pdh:=0;
         MatDeConstructfwd_pdw:=0
         
     }
     else
     {
         if(pad=1) then 
         {
             if(strd[0]=1) then 
             {
                 MatDeConstructfwd_pdh:=kers[0]-1
             }
             else
             {
                 MatDeConstructfwd_pdh:=kers[0]-src_h % strd[0]
             };
             if(strd[1]=1) then 
             {
                 MatDeConstructfwd_pdw:=kers[1]-1
             }
             else
             {
                 MatDeConstructfwd_pdw:=kers[1]-src[0].row % strd[1]
             }
         }
         else
         {
             return<==1 and RValue:=NULL;
             skip
         }
     };
     if(return=0)  then
     {
         if(des_h!=(src_h-1)*strd[0]+kers[0]-MatDeConstructfwd_pdh OR des[0].row!=(src[0].row-1)*strd[1]+kers[1]-MatDeConstructfwd_pdw OR kers[0]*kers[1]*des[0].col!=src[0].col) then 
         {
             output ("\t\terr check, unmathed matrix for MatDeConstruct\t\t\n") and skip;
             output ("\t\tDstShape:\n\t\t\t") and skip;
             MatplusShape(des,des_h);
             output ("\t\tSrcShape:\n\t\t\t") and skip;
             MatplusShape(src,src_h);
             return<==1 and RValue:=NULL;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             MatplusZeros(des,des_h,RValue);
             int MatDeConstructfwd_i,MatDeConstructfwd_j,MatDeConstructfwd_k and skip;
             MatDeConstructfwd_i:=0;
             
             while( (MatDeConstructfwd_i<src_h) )
             {
                 MatDeConstructfwd_j:=0;
                 
                 while( (MatDeConstructfwd_j<src[0].row) )
                 {
                     MatDeConstructfwd_k:=0;
                     
                     while( (MatDeConstructfwd_k<src[MatDeConstructfwd_i].col) )
                     {
                         int MatDeConstructfwd_d1,MatDeConstructfwd_d2,MatDeConstructfwd_d3 and skip;
                         MatDeConstructfwd_d1:=MatDeConstructfwd_i*strd[0]+(MatDeConstructfwd_k/ kers[1]) % kers[0];
                         MatDeConstructfwd_d2:=MatDeConstructfwd_j*strd[1]+MatDeConstructfwd_k % kers[1];
                         MatDeConstructfwd_d3:=MatDeConstructfwd_k/ (kers[0]*kers[1]);
                         if((MatDeConstructfwd_d1>MatDeConstructfwd_pdh/ 2 AND MatDeConstructfwd_d1<=src_h+MatDeConstructfwd_pdh/ 2) AND (MatDeConstructfwd_d2>MatDeConstructfwd_pdw/ 2 AND MatDeConstructfwd_d2<=src[0].row+MatDeConstructfwd_pdw/ 2)) then 
                         {
                             (des[MatDeConstructfwd_d1-MatDeConstructfwd_pdh/ 2-1].element[MatDeConstructfwd_d2-MatDeConstructfwd_pdw/ 2-1])[MatDeConstructfwd_d3]:=(des[MatDeConstructfwd_d1-MatDeConstructfwd_pdh/ 2-1].element[MatDeConstructfwd_d2-MatDeConstructfwd_pdw/ 2-1])[MatDeConstructfwd_d3]+(src[MatDeConstructfwd_i].element[MatDeConstructfwd_j])[MatDeConstructfwd_k]
                         }
                         else 
                         {
                              skip 
                         };
                         MatDeConstructfwd_k:=MatDeConstructfwd_k+1
                         
                     };
                     MatDeConstructfwd_j:=MatDeConstructfwd_j+1
                     
                 };
                 MatDeConstructfwd_i:=MatDeConstructfwd_i+1
                 
             };
             return<==1 and RValue:=des;
             skip
         }
         else
         {
             skip
         }
     }
     else
     {
         skip
     }
     )
     }; 
  function Matplus_TMulMatplus ( Mat *des,Mat *src1,int src1_h,Mat *src2,int src2_h,Mat* RValue )
 {
     frame(Matplus_TMulMatplus_i,Matplus_TMulMatplus_j,Matplus_TMulMatplus_m,Matplus_TMulMatplus_n,Matplus_TMulMatplus_tmp,return) and ( 
     int return<==0 and skip;
     if(src1_h!=src2_h OR src1[0].row!=src2[0].row OR des->row!=src1[0].col OR des->col!=src2[0].col) then 
     {
         output ("\t\terr check, unmathed matrix for Matplus_TMulMatplus\t\t\n") and skip;
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int Matplus_TMulMatplus_i,Matplus_TMulMatplus_j,Matplus_TMulMatplus_m,Matplus_TMulMatplus_n and skip;
         float Matplus_TMulMatplus_tmp<==0.0 and skip;
         Matplus_TMulMatplus_i:=0;
         
         while( (Matplus_TMulMatplus_i<des->row) )
         {
             Matplus_TMulMatplus_j:=0;
             
             while( (Matplus_TMulMatplus_j<des->col) )
             {
                 Matplus_TMulMatplus_m:=0;
                 
                 while( (Matplus_TMulMatplus_m<src1_h) )
                 {
                     Matplus_TMulMatplus_n:=0;
                     
                     while( (Matplus_TMulMatplus_n<src1[0].row) )
                     {
                         Matplus_TMulMatplus_tmp:=Matplus_TMulMatplus_tmp+(src1[Matplus_TMulMatplus_m].element[Matplus_TMulMatplus_n])[Matplus_TMulMatplus_i]*(src1[Matplus_TMulMatplus_m].element[Matplus_TMulMatplus_n])[Matplus_TMulMatplus_j];
                         Matplus_TMulMatplus_n:=Matplus_TMulMatplus_n+1
                         
                     };
                     Matplus_TMulMatplus_m:=Matplus_TMulMatplus_m+1
                     
                 };
                 (des->element[Matplus_TMulMatplus_i])[Matplus_TMulMatplus_j]:=Matplus_TMulMatplus_tmp;
                 Matplus_TMulMatplus_tmp:=0.0;
                 Matplus_TMulMatplus_j:=Matplus_TMulMatplus_j+1
                 
             };
             Matplus_TMulMatplus_i:=Matplus_TMulMatplus_i+1
             
         };
         return<==1 and RValue:=des;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function Matplus_TMulMatplusSumDes ( Mat *des,Mat *src1,int src1_h,Mat *src2,int src2_h,int BatchSize,Mat* RValue )
 {
     frame(Matplus_TMulMatplusSumDes_i,Matplus_TMulMatplusSumDes_j,Matplus_TMulMatplusSumDes_m,Matplus_TMulMatplusSumDes_n,Matplus_TMulMatplusSumDes_tmp,return) and ( 
     int return<==0 and skip;
     if(src1_h!=src2_h OR src1[0].row!=src2[0].row OR des->row!=src1[0].col OR des->col!=src2[0].col) then 
     {
         output ("\t\terr check, unmathed matrix for Matplus_TMulMatplus\t\t\n") and skip;
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int Matplus_TMulMatplusSumDes_i,Matplus_TMulMatplusSumDes_j,Matplus_TMulMatplusSumDes_m,Matplus_TMulMatplusSumDes_n and skip;
         float Matplus_TMulMatplusSumDes_tmp<==0.0 and skip;
         Matplus_TMulMatplusSumDes_i:=0;
         
         while( (Matplus_TMulMatplusSumDes_i<des->row) )
         {
             Matplus_TMulMatplusSumDes_j:=0;
             
             while( (Matplus_TMulMatplusSumDes_j<des->col) )
             {
                 Matplus_TMulMatplusSumDes_m:=0;
                 
                 while( (Matplus_TMulMatplusSumDes_m<src1_h) )
                 {
                     Matplus_TMulMatplusSumDes_n:=0;
                     
                     while( (Matplus_TMulMatplusSumDes_n<src1[0].row) )
                     {
                         Matplus_TMulMatplusSumDes_tmp:=Matplus_TMulMatplusSumDes_tmp+(src1[Matplus_TMulMatplusSumDes_m].element[Matplus_TMulMatplusSumDes_n])[Matplus_TMulMatplusSumDes_i]*(src2[Matplus_TMulMatplusSumDes_m].element[Matplus_TMulMatplusSumDes_n])[Matplus_TMulMatplusSumDes_j];
                         Matplus_TMulMatplusSumDes_n:=Matplus_TMulMatplusSumDes_n+1
                         
                     };
                     Matplus_TMulMatplusSumDes_m:=Matplus_TMulMatplusSumDes_m+1
                     
                 };
                 (des->element[Matplus_TMulMatplusSumDes_i])[Matplus_TMulMatplusSumDes_j]:=(des->element[Matplus_TMulMatplusSumDes_i])[Matplus_TMulMatplusSumDes_j]+(float)(Matplus_TMulMatplusSumDes_tmp/ BatchSize);
                 Matplus_TMulMatplusSumDes_tmp:=0.0;
                 Matplus_TMulMatplusSumDes_j:=Matplus_TMulMatplusSumDes_j+1
                 
             };
             Matplus_TMulMatplusSumDes_i:=Matplus_TMulMatplusSumDes_i+1
             
         };
         return<==1 and RValue:=des;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MaxChoose ( Mat *am,int am_h,Mat *km,Mat *om,int om_h,Mat* RValue )
 {
     frame(MaxChoose_ka,MaxChoose_i,MaxChoose_j,MaxChoose_k,MaxChoose_l,return) and ( 
     int return<==0 and skip;
     if(am_h!=om_h OR am[0].row!=om[0].row) then 
     {
         output ("\t\terr check, unmathed matrix for MaxChoose\t\t\n") and skip;
         output ("\t\tActiMatShape:\n\t\t\t") and skip;
         MatplusShape(am,am_h);
         output ("\t\tOriginActiMatShape:\n\t\t\t") and skip;
         MatplusShape(om,om_h);
         output ("\t\tKernelMatShape:\n\t\t\t") and skip;
         MatShape(km);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int MaxChoose_ka<==om[0].col/ am[0].col and skip;
         int MaxChoose_i,MaxChoose_j,MaxChoose_k,MaxChoose_l and skip;
         MaxChoose_i:=0;
         
         while( (MaxChoose_i<am_h) )
         {
             MaxChoose_j:=0;
             
             while( (MaxChoose_j<am[0].row) )
             {
                 MaxChoose_k:=0;
                 
                 while( (MaxChoose_k<am[0].col) )
                 {
                     (am[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k]:=(om[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k*MaxChoose_ka];
                     (km->element[MaxChoose_i*am[0].row+MaxChoose_j])[MaxChoose_k]:=0;
                     MaxChoose_l:=1;
                     
                     while( (MaxChoose_l<MaxChoose_ka) )
                     {
                         if((am[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k]<(om[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k*MaxChoose_ka+MaxChoose_l]) then 
                         {
                             (am[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k]:=(om[MaxChoose_i].element[MaxChoose_j])[MaxChoose_k*MaxChoose_ka+MaxChoose_l];
                             (km->element[MaxChoose_i*am[0].row+MaxChoose_j])[MaxChoose_k]:=MaxChoose_l
                             
                         }
                         else 
                         {
                              skip 
                         };
                         MaxChoose_l:=MaxChoose_l+1
                         
                     };
                     MaxChoose_k:=MaxChoose_k+1
                     
                 };
                 MaxChoose_j:=MaxChoose_j+1
                 
             };
             MaxChoose_i:=MaxChoose_i+1
             
         };
         return<==1 and RValue:=am;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function DeMaxChoose ( Mat *dm,int dm_h,Mat *km,Mat *dml,int dml_h,Mat* RValue )
 {
     frame(DeMaxChoose_ka,DeMaxChoose_i,DeMaxChoose_j,DeMaxChoose_k,DeMaxChoose_l,return) and ( 
     int return<==0 and skip;
     int DeMaxChoose_ka<==dm[0].col/ dml[0].col and skip;
     int DeMaxChoose_i,DeMaxChoose_j,DeMaxChoose_k,DeMaxChoose_l and skip;
     DeMaxChoose_i:=0;
     
     while( (DeMaxChoose_i<dm_h) )
     {
         DeMaxChoose_j:=0;
         
         while( (DeMaxChoose_j<dm[0].row) )
         {
             DeMaxChoose_k:=0;
             
             while( (DeMaxChoose_k<km->col) )
             {
                 DeMaxChoose_l:=0;
                 
                 while( (DeMaxChoose_l<DeMaxChoose_ka) )
                 {
                     if((km->element[DeMaxChoose_i*km->col+DeMaxChoose_j])[DeMaxChoose_k]=DeMaxChoose_l) then 
                     {
                         (dm[DeMaxChoose_i].element[DeMaxChoose_j])[DeMaxChoose_k*DeMaxChoose_ka+DeMaxChoose_l]:=(dml[DeMaxChoose_i].element[DeMaxChoose_j])[DeMaxChoose_k]
                         
                     }
                     else
                     {
                         (dm[DeMaxChoose_i].element[DeMaxChoose_j])[DeMaxChoose_k*DeMaxChoose_ka+DeMaxChoose_l]:=0
                     };
                     DeMaxChoose_l:=DeMaxChoose_l+1
                     
                 };
                 DeMaxChoose_k:=DeMaxChoose_k+1
                 
             };
             DeMaxChoose_j:=DeMaxChoose_j+1
             
         };
         DeMaxChoose_i:=DeMaxChoose_i+1
         
     };
     return<==1 and RValue:=dm;
     skip
     )
     }; 
  function FCload ( Mat *om,Mat *am,int am_h,Mat* RValue )
 {
     frame(FCload_i,FCload_j,FCload_k,FCload_omcnt,return) and ( 
     int return<==0 and skip;
     if(om[0].col!=am_h*am[0].row*am[0].col+1) then 
     {
         output ("\t\terr check, unmathed matrix for FCload\t\t\n") and skip;
         output ("\t\tActiMatShape:\n\t\t\t") and skip;
         MatplusShape(am,am_h);
         output ("\t\tOriginMatShape:\n\t\t\t") and skip;
         MatplusShape(om,1);
         return<==1 and RValue:=NULL;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int FCload_i,FCload_j,FCload_k and skip;
         int FCload_omcnt<==1 and skip;
         (om[0].element[0])[0]:=1.0;
         FCload_i:=0;
         
         while( (FCload_i<am_h) )
         {
             FCload_j:=0;
             
             while( (FCload_j<am[0].row) )
             {
                 FCload_k:=0;
                 
                 while( (FCload_k<am[0].col) )
                 {
                     (om[0].element[0])[FCload_omcnt]:=(am[FCload_i].element[FCload_j])[FCload_k];
                     FCload_omcnt:=FCload_omcnt+1;
                     FCload_k:=FCload_k+1
                     
                 };
                 FCload_j:=FCload_j+1
                 
             };
             FCload_i:=FCload_i+1
             
         };
         return<==1 and RValue:=om;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function MatplusActivate ( Mat *src,Mat *dst,int hgt,int way,Mat* RValue )
 {
     frame(MatplusActivate_i,return) and ( 
     int return<==0 and skip;
     int MatplusActivate_i and skip;
     if(way=0) then 
     {
         MatplusActivate_i:=0;
         
         while( (MatplusActivate_i<hgt) )
         {
             MatNoneActi(&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
             MatplusActivate_i:=MatplusActivate_i+1
             
         }
         
     }
     else
     {
         if(way=1) then 
         {
             MatplusActivate_i:=0;
             
             while( (MatplusActivate_i<hgt) )
             {
                 MatSigmoid(&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
                 MatplusActivate_i:=MatplusActivate_i+1
                 
             }
         }
         else
         {
             if(way=2) then 
             {
                 MatplusActivate_i:=0;
                 
                 while( (MatplusActivate_i<hgt) )
                 {
                     MatTanh(&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
                     MatplusActivate_i:=MatplusActivate_i+1
                     
                 }
             }
             else
             {
                 if(way=3) then 
                 {
                     MatplusActivate_i:=0;
                     
                     while( (MatplusActivate_i<hgt) )
                     {
                         MatRelu(&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
                         MatplusActivate_i:=MatplusActivate_i+1
                         
                     }
                 }
                 else
                 {
                     if(way=4) then 
                     {
                         MatplusActivate_i:=0;
                         
                         while( (MatplusActivate_i<hgt) )
                         {
                             MatLeakyRelu(0.2,&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
                             MatplusActivate_i:=MatplusActivate_i+1
                             
                         }
                     }
                     else
                     {
                         if(way=5) then 
                         {
                             MatplusActivate_i:=0;
                             
                             while( (MatplusActivate_i<hgt) )
                             {
                                 MatSoftmax(&src[MatplusActivate_i],&dst[MatplusActivate_i],RValue);
                                 MatplusActivate_i:=MatplusActivate_i+1
                                 
                             }
                         }
                         else
                         {
                             output ("error for MatActivate, please check ActiFsHidden  variable!\n") and skip
                         }
                     }
                 }
             }
         }
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function MatplusDerivate ( Mat *src,Mat *dst,int hgt,int way,Mat* RValue )
 {
     frame(MatplusDerivate_i,return) and ( 
     int return<==0 and skip;
     int MatplusDerivate_i and skip;
     if(way=0) then 
     {
         MatplusDerivate_i:=0;
         
         while( (MatplusDerivate_i<hgt) )
         {
             MatDerivationNoneActi(&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
             MatplusDerivate_i:=MatplusDerivate_i+1
             
         }
         
     }
     else
     {
         if(way=1) then 
         {
             MatplusDerivate_i:=0;
             
             while( (MatplusDerivate_i<hgt) )
             {
                 MatDerivationSigmoid(&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
                 MatplusDerivate_i:=MatplusDerivate_i+1
                 
             }
         }
         else
         {
             if(way=2) then 
             {
                 MatplusDerivate_i:=0;
                 
                 while( (MatplusDerivate_i<hgt) )
                 {
                     MatDerivationTanh(&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
                     MatplusDerivate_i:=MatplusDerivate_i+1
                     
                 }
             }
             else
             {
                 if(way=3) then 
                 {
                     MatplusDerivate_i:=0;
                     
                     while( (MatplusDerivate_i<hgt) )
                     {
                         MatDerivationRelu(&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
                         MatplusDerivate_i:=MatplusDerivate_i+1
                         
                     }
                 }
                 else
                 {
                     if(way=4) then 
                     {
                         MatplusDerivate_i:=0;
                         
                         while( (MatplusDerivate_i<hgt) )
                         {
                             MatDerivationLeakyRelu(0.2,&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
                             MatplusDerivate_i:=MatplusDerivate_i+1
                             
                         }
                     }
                     else
                     {
                         if(way=5) then 
                         {
                             MatplusDerivate_i:=0;
                             
                             while( (MatplusDerivate_i<hgt) )
                             {
                                 MatDerivationSoftmax(&src[MatplusDerivate_i],&dst[MatplusDerivate_i],RValue);
                                 MatplusDerivate_i:=MatplusDerivate_i+1
                                 
                             }
                         }
                         else
                         {
                             output ("error for MatActivate, please check ActiFsHidden  variable!\n") and skip
                         }
                     }
                 }
             }
         }
     };
     return<==1 and RValue:=dst;
     skip
     )
     }; 
  function LossFunction ( Mat *src,Mat *dst,int Nstr_LossF,float RValue )
 {
     frame(return) and ( 
     int return<==0 and skip;
     if(Nstr_LossF=0) then 
     {
         return<==1 and RValue:=MSE(src,dst,RValue);
         skip
     }
     else
     {
         if(Nstr_LossF=1) then 
         {
             return<==1 and RValue:=CrossEntropy(src,dst,RValue);
             skip
         }
         else
         {
 output ("error for Nstr_LossF, please check loss function variable!\n") and skip;
 return<==1 and RValue:=-1;
 skip
 }
 }
 )
 }; 
  function inputCNN ( float *data,CNN *cnn )
 {
     frame(inputCNN_i,inputCNN_j,inputCNN_k,inputCNN_cnt) and ( 
     int inputCNN_i,inputCNN_j,inputCNN_k,inputCNN_cnt<==0 and skip;
     inputCNN_i:=0;
     
     while( (inputCNN_i<cnn->Layers[0].ActiMat[inputCNN_i].col) )
     {
         inputCNN_j:=0;
         
         while( (inputCNN_j<cnn->Layers[0].OutH) )
         {
             inputCNN_k:=0;
             
             while( (inputCNN_k<cnn->Layers[0].ActiMat[inputCNN_i].row) )
             {
                 (cnn->Layers[0].ActiMat[inputCNN_j].element[inputCNN_k])[inputCNN_i]:=data[inputCNN_cnt];
                 inputCNN_cnt:=inputCNN_cnt+1;
                 inputCNN_k:=inputCNN_k+1
                 
             };
             inputCNN_j:=inputCNN_j+1
             
         };
         inputCNN_i:=inputCNN_i+1
         
     }
     )
     }; 
  function inputCNNLabel ( float *data,CNN *cnn )
 {
     frame(inputCNNLabel_i) and ( 
     int inputCNNLabel_i and skip;
     inputCNNLabel_i:=0;
     
     while( (inputCNNLabel_i<cnn->OnehotMat.col) )
     {
         (cnn->OnehotMat.element[0])[inputCNNLabel_i]:=data[inputCNNLabel_i];
         inputCNNLabel_i:=inputCNNLabel_i+1
         
     }
     )
     }; 
  function NNFCforward ( Layer *FCLayer,Mat *AM,int am_h )
 {
     FCLayer->OriginMat:=FCload(FCLayer->OriginMat,AM,am_h,RValue);
     FCLayer->SumMat:=MatplusMulMat(FCLayer->SumMat,FCLayer->OutH,FCLayer->OriginMat,FCLayer->OutH,FCLayer->WeightMat,RValue);
     FCLayer->ActiMat:=MatplusActivate(FCLayer->SumMat,FCLayer->ActiMat,1,FCLayer->ActiFuncNum,RValue);
     FCLayer->DeriMat:=MatplusDerivate(FCLayer->ActiMat,FCLayer->DeriMat,FCLayer->OutH,FCLayer->ActiFuncNum,RValue)
     
 };
 function NNCVforward ( Layer *CVLayer,Mat *AM,int am_h )
 {
     CVLayer->OriginMat:=MatPadReConstructBias(CVLayer->OriginMat,CVLayer->OutH,AM,am_h,CVLayer->KernelSize,CVLayer->Stride,CVLayer->PaddingMode,RValue);
     CVLayer->SumMat:=MatplusMulMat(CVLayer->SumMat,CVLayer->OutH,CVLayer->OriginMat,CVLayer->OutH,CVLayer->WeightMat,RValue);
     CVLayer->ActiMat:=MatplusActivate(CVLayer->SumMat,CVLayer->ActiMat,CVLayer->OutH,CVLayer->ActiFuncNum,RValue);
     CVLayer->DeriMat:=MatplusDerivate(CVLayer->ActiMat,CVLayer->DeriMat,CVLayer->OutH,CVLayer->ActiFuncNum,RValue)
     
 };
 function NNDCforward ( Layer *DCLayer,Mat *AM,int am_h )
 {
     DCLayer->OriginMat:=MatplusMulMat(DCLayer->OriginMat,am_h,AM,am_h,DCLayer->KernelMat,RValue);
     DCLayer->SumMat:=MatPadReConstruct(DCLayer->SumMat,DCLayer->OutH,DCLayer->OriginMat,am_h,DCLayer->KernelSize,DCLayer->Stride,0,RValue);
     DCLayer->ActiMat:=MatplusActivate(DCLayer->ActiMat,DCLayer->ActiMat,DCLayer->OutH,DCLayer->ActiFuncNum,RValue);
     DCLayer->DeriMat:=MatplusDerivate(DCLayer->ActiMat,DCLayer->DeriMat,DCLayer->OutH,DCLayer->ActiFuncNum,RValue)
     
 };
 function NNMPforward ( Layer *MPLayer,Mat *AM,int am_h )
 {
     MPLayer->OriginMat:=MatPadReConstruct(MPLayer->OriginMat,MPLayer->OutH,AM,am_h,MPLayer->KernelSize,MPLayer->Stride,MPLayer->PaddingMode,RValue);
     MPLayer->ActiMat:=MaxChoose(MPLayer->ActiMat,MPLayer->OutH,&MPLayer->KernelMat,MPLayer->OriginMat,MPLayer->OutH,RValue)
     
 };
 function NNAPforward ( Layer *APLayer,Mat *AM,int am_h )
 {
     APLayer->OriginMat:=MatPadReConstructBias(APLayer->OriginMat,APLayer->OutH,AM,am_h,APLayer->KernelSize,APLayer->Stride,APLayer->PaddingMode,RValue);
     APLayer->ActiMat:=MatplusMulMat(APLayer->ActiMat,APLayer->OutH,APLayer->OriginMat,APLayer->OutH,APLayer->KernelMat,RValue)
     
 };
 function NNforwardLayer ( Layer *layer,Mat *AM,int am_h )
 {
     if(layer->LayerType=0) then 
     {
         NNFCforward(layer,AM,am_h)
         
     }
     else 
     {
          skip 
     };
     if(layer->LayerType=1) then 
     {
         NNCVforward(layer,AM,am_h)
         
     }
     else 
     {
          skip 
     };
     if(layer->LayerType=2) then 
     {
         NNDCforward(layer,AM,am_h)
         
     }
     else 
     {
          skip 
     };
     if(layer->LayerType=3) then 
     {
         NNMPforward(layer,AM,am_h)
         
     }
     else 
     {
          skip 
     };
     if(layer->LayerType=4) then 
     {
         NNAPforward(layer,AM,am_h)
         
     }
     else 
     {
          skip 
     }
     
 };
 function NNforwardSingle ( CNN *cnn,float RValue )
 {
     frame(NNforwardSingle_i,NNforwardSingle_s,NNforwardSingle_loss,return) and ( 
     int return<==0 and skip;
     int NNforwardSingle_i and skip;
     char NNforwardSingle_s[40] and skip;
     NNforwardSingle_i:=1;
     
     while( (NNforwardSingle_i<cnn->HiddenLayerNum+2) )
     {
         NNforwardLayer(&cnn->Layers[NNforwardSingle_i],cnn->Layers[NNforwardSingle_i-1].ActiMat,cnn->Layers[NNforwardSingle_i-1].OutH);
         NNforwardSingle_i:=NNforwardSingle_i+1
         
     };
     float NNforwardSingle_loss<==-1.0 and skip;
     MatDump(&cnn->Layers[cnn->HiddenLayerNum+1].ActiMat[0]);
     MatDump(&cnn->OnehotMat);
     NNforwardSingle_loss:=LossFunction(&cnn->Layers[cnn->HiddenLayerNum+1].ActiMat[0],&cnn->OnehotMat,cnn->LossFuncNum,RValue);
     output ("Loss:",F2S(NNforwardSingle_loss,NNforwardSingle_s,RValue),"\n") and skip;
     return<==1 and RValue:=NNforwardSingle_loss;
     skip
     )
     }; 
  function ZeroGrad ( CNN *cnn )
 {
     frame(ZeroGrad_i) and ( 
     int ZeroGrad_i and skip;
     ZeroGrad_i:=1;
     
     while( (ZeroGrad_i<cnn->HiddenLayerNum+2) )
     {
         if(cnn->Layers[ZeroGrad_i].LayerType=0 OR cnn->Layers[ZeroGrad_i].LayerType=1 OR cnn->Layers[ZeroGrad_i].LayerType=2) then 
         {
             MatZeros(&cnn->Layers[ZeroGrad_i].NablaMat,RValue)
             
         }
         else 
         {
              skip 
         };
         ZeroGrad_i:=ZeroGrad_i+1
         
     }
     )
     }; 
  function NNpropagationBatch ( int BatchSize,Mat *FeatureMat,Mat *LabelMat,CNN *cnn,float RValue )
 {
     frame(NNpropagationBatch_i,NNpropagationBatch_loss,NNpropagationBatch_size,NNpropagationBatch_buf,return) and ( 
     int return<==0 and skip;
     int NNpropagationBatch_i and skip;
     float NNpropagationBatch_loss<==0.0 and skip;
     int NNpropagationBatch_size and skip;
     char NNpropagationBatch_buf[40] and skip;
     ZeroGrad(cnn);
     NNpropagationBatch_i:=0;
     
     while( return=0 AND   (NNpropagationBatch_i<BatchSize) )
     {
         if(cnn->Layers[0].ActiMat->row*cnn->Layers[0].OutH!=FeatureMat->col) then 
         {
             output ("\t\terr check, mismatching matrix for NNforward\t\t\n") and skip;
             output ("\t\tFeatureMatShape:\n\t\t\t") and skip;
             MatShape(FeatureMat);
             output ("\t\tlabelMatMatShape:\n\t\t\t") and skip;
             MatplusShape(cnn->Layers[0].ActiMat,cnn->Layers[0].OutH);
             return<==1 and RValue:=-1.0;
             skip
             
         }
         else 
         {
              skip 
         };
         if(return=0)   then 
         {
             inputCNN(FeatureMat->element[NNpropagationBatch_i],cnn);
             inputCNNLabel(LabelMat->element[NNpropagationBatch_i],cnn);
             NNpropagationBatch_loss:=NNpropagationBatch_loss+NNforwardSingle(cnn,RValue);
             NNpropagationBatch_i:=NNpropagationBatch_i+1
         }
         else
         {
             skip
         }
         
     };
     if(return=0)   then 
     {
         NNpropagationBatch_loss:=NNpropagationBatch_loss/ BatchSize;
         return<==1 and RValue:=NNpropagationBatch_loss;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  function main ( int  RValue )
 {
     frame(main_pdf,main_classifynum,main_onehot,main_channelnum,main_sig,main_LayerType,main_LayerParameters,main_ActiFuncNumArray,main_dataset,main_cnn,return) and ( 
     int return<==0 and skip;
     Predefine main_pdf and skip;
     InitPredefine(&main_pdf);
     int main_classifynum<==10 and skip;
     int main_onehot<==1 and skip;
     int main_channelnum<==1 and skip;
     int main_sig and skip;
     main_sig:=DR_loadMINST(main_classifynum,main_onehot,main_channelnum,&main_pdf,RValue);
     if(main_sig!=0) then 
     {
         output ("Dataset parr wrong.\n") and skip;
         return<==1 and RValue:=main_sig;
         skip
         
     }
     else 
     {
          skip 
     };
     if(return=0)   then 
     {
         int main_LayerType[7]<=={0,1,3,1,3,0,0} and skip;
         int main_LayerParameters[28]<=={1,3,3,2,2,2,3,0,2,2,1,1,1,2,2,1,1,4,3,0,2,2,1,1,256,3,10,5} and skip;
         int main_ActiFuncNumArray[7]<=={0,3,0,3,0,3,5} and skip;
         main_pdf.HiddenLayerNum:=5;
         main_pdf.WeightInitWayNum:=3;
         main_pdf.LossFuncNum:=1;
         main_pdf.BatchSize:=5;
         main_pdf.LayerType:=main_LayerType;
         main_pdf.LayerParameters:=main_LayerParameters;
         main_pdf.ActiFuncNumArray:=main_ActiFuncNumArray;
         main_pdf.ParametersTotal:=28;
         main_pdf.TrainSampleNum:=200;
         main_pdf.TestSampleNum:=50;
         main_pdf.CompleteSampleNum:=main_pdf.TrainSampleNum+main_pdf.TestSampleNum;
         DumpPredefine(main_pdf,RValue);
         DataSet main_dataset and skip;
         CNN main_cnn and skip;
         LoadParaFromPredefine(main_pdf,&main_dataset,&main_cnn);
         DataConstruct(&main_dataset);
         CreateNNSpaceAndLoadinPara2Layer(&main_cnn,main_pdf,RValue);
         DumpCNN(main_cnn,RValue);
         NNWeightInit(&main_cnn,RValue);
         NNpropagationBatch(main_dataset.BatchSize,&main_dataset.BatchTrainFeature[0],&main_dataset.BatchTrainLabel[0],&main_cnn,RValue);
         return<==1 and RValue:=0;
         skip
     }
     else
     {
         skip
     }
     )
     }; 
  main(RValue)
 )
